批量update
<update id="batchupdate">
<foreach collection="list" index="index" item="item" separator=";" open="" close="" >
update table
set clum1 = #{item.param1,jdbcType=VARCHAR}
where id = #{item.param2,jdbcType=VARCHAR}
</foreach>
</update>
用上面sql进行批量更新的时候,一直报语法错误,
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
此时纳闷了,我oracle的时候批量更新就没有问题呀,虽然写法稍有些不同,然后进行百度,各种查,网友说,在mysql的url后面加上&allowMultiQueries=true,我抱着试试的态度加上之后,问题完美解决,哈哈哈,记录一下