当前位置:网站首页>项目中批量update

项目中批量update

2022-07-05 15:26:00 小蚂蚁hjk

业务场景是,每条修改的值都不相同

dao

xml:

 做到这一步还没有完;此时mysql还不支持批量修改会报错

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 weibo_content
            SET
                EMOTION = 0.0
            W' at line 7
; bad SQL grammar []; nested exception is 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 weibo_content

当时一直以为是自己的语法有误其实不是的,这是因为配置数据源的时候缺少配置

&allowMultiQueries=true这条语句允许一次提交多条sql语句。特别是分号;

 完美解决,还是百度发现的

原网站

版权声明
本文为[小蚂蚁hjk]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_43167662/article/details/125332860