mysql举例:
<update id="batchUpdate" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="begin" close="end;" separator=";">
update test
<set>
test=${item.test}+1
</set>
where id = ${item.id}
</foreach>
</update>
问题:
update test SET PRICE_DESC = ?, UPDATED_STAMP = now(), UPDATED_USER = 'system' where ID = ? ; update test SET PRICE_DESC = ?, UPDATED_STAMP = now(), UPDATED_USER = 'system' where ID = ? ;
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'update car_price_change_workcard
解决方法:
mysql数据库采用一下写法即可执行,但是数据库连接必须配置:&allowMultiQueries=true
例如:jdbc:mysql://192.168.1.236:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
网友评论