Java Mybatis multiple update statements -
java mybatis oracle
i have following mybatis statement in xml file
<update id="updateofferindex" parametertype="java.util.list"> <foreach collection="list" item="offer" index="index" separator=";" > update offer set indx=#{offer.idx} id=#{offer.eid} </foreach>
i getting following error, can 1 ?
### error updating database. cause: java.sql.sqlsyntaxerrorexception: ora-00911: invalid character ### error may involve com.dao.linear.upsell.linearupselldao.updateofferindex-inline ### error occurred while setting parameters ### sql: update offer set indx=? id=? ; update offer set indx=? id=? ### cause: java.sql.sqlsyntaxerrorexception: ora-00911: invalid character
looks last semicolon has not been appended:
### sql: update offer set indx=? id=?; update offer set indx=? id=?;
and coherent mybatis documentation foreach's separator:
the element smart in won’t accidentally append separators.
try adding semicolon xml mapping:
<foreach collection="list" item="offer" index="index" separator=";" > update offer set indx=#{offer.idx} id=#{offer.eid} </foreach> ;
Comments
Post a Comment