Data truncation: Truncated incorrect DOUBLE value 解决方案
1.情况限制
此处的错误解决方案只讨论:
在使用Mybatis时,传入数组且使用<foreach>标签时出现此种报错;
2.报错案例
mapper.java
/**
* @Description: 取消验厂通知
* SupplierCheckfactoryInformMapper
* cancelNotifyToCheckFac
* @param params
* 2016-8-24 下午3:42:44
*/
public void cancelNotifyToCheckFac(
@Param("regId")Integer regId,
@Param("updateDt")Date updateDt,
@Param("supplierIds")BigInteger[] supplierIds
);
mapper.xml
<update id="cancelNotifyToCheckFac">
UPDATE
t_supplier_regaccount_info tsri,
t_supplier_checkfactory_inform tsci
SET
status = 2,
update_dt = #{updateDt}
WHERE
tsri.supplier_id = tsci.supplier_id
AND
tsri.supplier_id in
<foreach collection="supplierIds" item="item" index="index" open="(" separator="," close=")">
#{supplierIds}
</foreach>
AND
tsri.reg_id = #{regId}
AND
tsci.status = 0
</update>
报错信息:
### Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: '\xAC\xED\x00\x05ur\x00\x17[Ljava.math.BigInteger;\x0E|\xDBF\xE0:`\xC6\x02\x00\x00xp\x00\x00\x00\x01sr\x00\x14java.math.BigIntege'
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: UPDATE t_supplier_regaccount_info tsri, t_supplier_checkfactory_inform tsci SET status = 2, update_dt = ? WHERE tsri.supplier_id = tsci.supplier_id AND tsri.supplier_id in ( ? ) AND tsri.reg_id = ? AND tsci.status = 0
### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: '\xAC\xED\x00\x05ur\x00\x17[Ljava.math.BigInteger;\x0E|\xDBF\xE0:`\xC6\x02\x00\x00xp\x00\x00\x00\x01sr\x00\x14java.math.BigIntege'
; SQL []; Data truncation: Truncated incorrect DOUBLE value: '\xAC\xED\x00\x05ur\x00\x17[Ljava.math.BigInteger;\x0E|\xDBF\xE0:`\xC6\x02\x00\x00xp\x00\x00\x00\x01sr\x00\x14java.math.BigIntege'; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: '\xAC\xED\x00\x05ur\x00\x17[Ljava.math.BigInteger;\x0E|\xDBF\xE0:`\xC6\x02\x00\x00xp\x00\x00\x00\x01sr\x00\x14java.math.BigIntege'
ERROR 2016-09-18 15:03:17,661 util.web.ExceptionAdvisor: 内部/外部请求人:/admin
ERROR 2016-09-18 15:03:17,661 util.web.ExceptionAdvisor: 请求IP:0:0:0:0:0:0:0:1
ERROR 2016-09-18 15:03:17,662 util.web.ExceptionAdvisor: 请求参数:{supplierId=26};
ERROR 2016-09-18 15:03:17,662 util.web.ExceptionAdvisor: =====service通知结束,继续向上抛BusinessException=====
WARN 2016-09-18 15:03:17,669 org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver: Handler execution resulted in exception
common.model.BusinessException: 抱歉,程序内部错误,操作失败! 请稍后再试或与管理员联系!
3.错误分析
此处的报错信息:Data truncation: Truncated incorrect DOUBLE value
3.1:在网上的主要错误原因是:update语句中的set中出现了and关键字,而应该使用逗号<,>代替之;这里的报错不属于这种情况;
3.2:此处错误原因为:<foreach>标签中不能使用参数名#{supplierIds},而应该使用#{item},貌似为固定写法;根本原因尚不明确,待大神指点;
4.代码修改后
mapper.xml
<update id="cancelNotifyToCheckFac">
UPDATE
t_supplier_regaccount_info tsri,
t_supplier_checkfactory_inform tsci
SET
status = 2,
update_dt = #{updateDt}
WHERE
tsri.supplier_id = tsci.supplier_id
AND
tsri.supplier_id in
<foreach collection="supplierIds" item="item" index="index" open="(" separator="," close=")">
#{item} <-- *此处为错误原因* -->
</foreach>
AND
tsri.reg_id = #{regId}
AND
tsci.status = 0
</update>
其他的代码不做修改;
5.结果
修改后,可正常更新记录,不再报错;
Data truncation: Truncated incorrect DOUBLE value 解决方案的更多相关文章
- Data truncation: Truncated incorrect DOUBLE value错误的解决方案
Data truncation: Truncated incorrect DOUBLE value错误的解决方案: 当在修改某条单位记录时,发生了Data truncation: Truncated ...
- Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'L
1.错误叙述性说明 [ERROR:]2015-06-08 09:49:42,523 [异常拦截] org.hibernate.exception.DataException: error execut ...
- Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'L
1.错误描述 [ERROR:]2015-06-08 09:49:42,523 [异常拦截] org.hibernate.exception.DataException: error executing ...
- Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'as3'
执行更新时的出错信息 Whitelabel Error Page This application has no explicit mapping for /error, so you are see ...
- com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value:...
在使用mybatis的@Update注解的时候,报了一个这样的错 ### Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncat ...
- Data truncation: Truncated incorrect DOUBLE value:
在写sql查询语句queryRunner.update(connection,"update account set balance=? where name=?",account ...
- java.sql.SQLException: Data truncation: Truncated incorrect DOUBLE value
mysql 报这个异常:java.sql.SQLException: Data truncation: Truncated incorrect DOUBLE value update 表名 set c ...
- 异常-Data truncation: Truncated incorrect DOUBLE value: '-9370.3530-'
1详细异常日志 9/11/04 17:36:09 ERROR base.SQLHelper: Data truncation: Truncated incorrect DOUBLE value: '- ...
- Mysql [Err] 1292 - Truncated incorrect DOUBLE value: 'a'
报错信息: [SQL] UPDATE 表 set times = 1 where type = 1 and times = 0 [Err] 1292 - Truncated incorrect DOU ...
随机推荐
- org.hibernate.TransientObjectException
使用JPA注解@ManyToMany做一个多对多的用例. 为了避免在删除主表数据时同时级联删除从表数据,JPA官方文档建议在主表的从表字段使用级联注解:CascadeType.PERSIST,Casc ...
- Quartz集群原理及配置应用
1.Quartz任务调度的基本实现原理 Quartz是OpenSymphony开源组织在任务调度领域的一个开源项目,完全基于Java实现.作为一个优秀的开源调度框架,Quartz具有以下特点: (1) ...
- ThinkPHP跳转与重定向的区别在哪里
跳转: 浏览器认为 : 当前 URL 请求成功 , 重新请求新的 URL . 浏览器会记录当前的 URL 和新的 URL 在请求历史记录中. 回退, 是可以回退到 , 当前的 URL 上的 . ( 无 ...
- Discuz2 x3深入研究内容资料
http://blog.csdn.net/yanhui_wei/article/category/1136193
- C++11的一些新特性
3.1.9崭新的Template特性 Variadic Template 可变参数模板 void print() { } template <typename T, typename… Type ...
- tomcat清除缓存
方案一:点击进入解压后的tomcat,找到work文件夹,.此文件下有个catalina目录(tomcat小名叫catalina),work目录下的文件都可以删除.如果我们先前发布的一个项目有错,大家 ...
- git: fatal unable to auto-detect email address
参考:http://stackoverflow.com/questions/25671785/git-fatal-unable-to-auto-detect-email-address 正确使用命令: ...
- volatile关键字解析
转载:http://www.cnblogs.com/dolphin0520/p/3920373.html volatile这个关键字可能很多朋友都听说过,或许也都用过.在Java 5之前,它是一个备受 ...
- 基于@AspectJ和schema的aop(三)---切点函数详解
切点函数是AspectJ表达式语言的核心, 也是使用@AspectJ进行切面定义的难点.本小节我们通过具体的实例对切点函数进行深入学习. 1.@annotation() @annotation()表示 ...
- lua中奇葩用法
th> a=torch.zeros(,) [.0001s] th> a [torch.DoubleTensor of size 1x5] [.0002s] th> a[] [torc ...