mybatis批量更新(update foreach)失败
来源:互联网 发布:js 仿京东楼层特效 编辑:程序博客网 时间:2024/05/24 22:45
最近做项目需要一个很奇葩的现象,项目是spring+springMvc+mybatis ,在本地进行批量更新时是成功的,但上到线上环境就一直报错,代码如下:
<!--批量更新报表 --> <update id="updateIssueReportByBatch" parameterType="java.util.List"> <foreach collection="issueReportList" item="item" index="index" separator=";"> update sys_issue_report <set> <if test="item.firstClass != null and item.firstClass != ''"><![CDATA[first_class = #{item.firstClass},]]> </if> <if test="item.secondClass != null and item.secondClass != ''"><![CDATA[second_class = #{item.secondClass},]]> </if> updated_time = now() </set> where issue_id = #{item.issueId} and status = 1 </foreach> </update>
在线上的时候一直报这样的错误:
The error occurred while setting parameters刚开始一直以为是由于线上的数据和本地的数据不一致造成的,把线上的数据拿过来测试了很多会还是报同样的错,
然后上网查询说是配置mysql的时候没有开启批量插入,就查询了项目的是否配置了allowMultiQueries=true,发现本地和线上都配置了该语句,问题没出在这,
那问题出在哪呢,后来发现是由于线上将&变成了&造成的.前后对比如下:
修改前:
jdbc.url=jdbc:mysql://XXX/abc?useUnicode=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true修改后:
jdbc.url=jdbc:mysql://XXX/abc?useUnicode=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
这样一个bug整整让我改了2天,记录下,希望有同样问题的同学能顺利解决
阅读全文
0 0
- mybatis批量更新(update foreach)失败
- mysql 批量更新 update foreach
- mysql 批量更新 update foreach
- mysql 批量更新 update foreach
- 【mybatis】批量更新失败
- mybatis执行批量更新update
- mybatis执行批量更新update
- mybatis 批量更新update详解
- MyBatis Batch Update Exception 使用foreach 批量update 出错
- MyBatis oracle 批量 insert update 新增 更新
- mybatis执行update批量更新时报错
- mybatis批量更新(on duplicate key update)
- Mybatis 批量更新失败,单条成功
- Mybatis foreach 批量操作
- Mybatis foreach 批量操作
- mybatis foreach 批量操作
- mybatis执行批量更新update 的方法oracle小记
- mybatis执行批量更新batch update 的方法
- 1119. Pre- and Post-order Traversals (30)
- SOA面向服务的架构概念梳理
- 文章标题
- bat文件(cmd命令批处理)的编写使用
- Qt打印预览
- mybatis批量更新(update foreach)失败
- SpingBoot Quartz配置及数据库持久化配置
- TensorFlow学习笔记(二):实现神经网络
- spark资源调度分配
- log4j2教程【RollingFileAppender】
- django-channels小结
- Android--通过网页打开APP并传值详解
- 对企业账户来说,调试证书和发布证书的区别
- Cassandra CQL的限制