2014-10-30 1 views
1

행이 거의 업데이트되지 않고 행을 업데이트 한 후 영향을받는 행 수를 반환하려고합니다. 우리는 selectKey 태그를 추가 할 때, 우리는 오류 "The content of element type "update" must match "(include|dynamic|iterate|isParameterPresent|isNotParameterPresent|isEmpty|isNotEmpty|isNotNull|isNull|isNotEqual|isEqual| isGreaterThan|isGreaterEqual|isLessThan|isLessEqual|isPropertyAvailable|isNotPropertyAvailable)"를 얻을 수를 영향을받는 행의 수를 반환 들어MyBatis/Ibatis 오류 : 요소 유형 "update"의 내용이 일치해야합니다.

<update id="update" parameterClass="com.test.Delete"> 
     update entity_association set deleted = 1, syncTS = #syncTS# where 
     assoc_entity_row_id in 
     <iterate property="parentIds" open="(" close=")" conjunction=","> 
      #parentIds[]# 
     </iterate> 
     and assoc_entity_type = #parentType#; 
     <selectKey resultClass="int"> 
      select row_count() 
     </selectKey> 
    </update> 

을 다음과 같이 우리는 우리의 XML 파일을 작성했습니다.

이것을 구현하는 더 좋은 방법이 있습니까? selectKey 태그는 삽입에 잘 작동합니다.

+0

태그에 태그가 포함되어 있지 않은 것으로 보입니다. myBatis/iBatis 문서를 확인하십시오. 나는 업데이트가 이미 업데이트 된 행의 수를 반환한다고 생각한다. – DwB

답변

0

dtd 스키마 유효성 검사기로 인해이 오류가 발생한다고 생각합니다. mybatis/ibatis 버전에 따라 다른 dtd 스키마를 사용할 수 있습니다. Mapper 네임 스페이스 스키마 규칙을 확인하십시오. = dtd schema을 사용하고 foreach 및 select 키워드로 업데이트하면 문제가 없습니다.

0

이 작업을 수행하기위한 해킹을 찾았습니다. 태그 내부에 업데이트 쿼리를 묶고 터치 한 행 수를 반환했습니다.