2014-10-30 220 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

發現一個破解使這個工作。我們在標籤內附加了更新查詢並返回了被觸摸的行數。

相關問題