2014-10-30 223 views
1

我们更新了几行,在更新行后,我们希望返回受影响的行数。我们如下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> 

回访影响计数,当我们添加标签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)"行的数量来写我们的XML文件。

有没有更好的实现方法? selectKey标签对插入工作正常。

+0

它看起来像标记可能不包含标记。检查myBatis/iBatis文档;我认为更新已经返回更新的行数。 – DwB 2014-10-30 14:55:06

回答

0

我认为dtd模式验证器会导致此错误。根据您的版本mybatis/ibatis,您可以使用不同的dtd模式。请检查它在模式规则映射器名称空间=我使用dtd schema和更新与foreach和选择关键字工作正常。

0

发现一个破解使这个工作。我们在标签内附加了更新查询并返回了被触摸的行数。

相关问题