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 ...
随机推荐
- Hibernate,Session清理缓存时间点
当应用程序调用org.hibernate.Transaction的commit()的时候,commit()方法先清理缓存,然后再向数据库提交事务. 当应用程序显示调用Session.flush()方法 ...
- 将helps.php或者functions.php直接进行了加载
TP3系列中functions.php文件默认其实是空文件,很好找.我们可以直接封装代码. Laravel5系列中的path/vendor/laravel/framework/src/Illumina ...
- Apache Mina 入门实例
这个教程是介绍使用Mina搭建基础示例.这个教程内容是以创建一个时间服务器. 以下是这个教程需要准备的东西: MINA 2.0.7 Core JDK 1.5 或更高 SLF4J 1.3.0 或更高 L ...
- Houdini Krakatoa Render Plugin
HDK真实个混蛋,都懒得写个解释.凭着函数英文意思猜测.. plugin sample video: 在极其残忍的开发环境,"Particle Voxel Render" 产生了( ...
- quick lua 使用spine骨骼动画
看下下面两个文件 <spine/SkeletonRenderer.h><spine/SkeletonAnimation.h> 1.lua中创建方法: sp.SkeletonAn ...
- 【转】使用JDK自带jvisualvm监控tomcat
转载地址: http://my.oschina.net/kone/blog/157239 jdk自带有个jvisualvm工具.该工具是用来监控java运行程序的cpu.内存.线程等的使用情况.并且使 ...
- matlab mat文件读取和调用
13.1 数据基本操作 本节介绍基本的数据操作,包括工作区的保存.导入和文件打开.13.1.1 文件的存储 MATLAB支持工作区的保存.用户可以将工作区或工作区中的变量以文件的形式保存,以备在需要时 ...
- C# PDF添加水印
需要iTextSharp.dll, 下载地址http://sourceforge.net/projects/itextsharp/ using System;using System.Collecti ...
- 基于clahe的图像去雾
基于clahe的图像去雾 通过阅读一些资料,我了解到clahe算法对图像去雾有所价值,正好opencv中有了实现,拿过来看一看. 但是现在实现的效果还是有所差异 #); clahe] ...
- python INFO: Can't locate Tcl/Tk libs and/or headers
安装opencv的时候遇到这个错误: python INFO: Can't locate Tcl/Tk libs and/or headers 参考如下文章解决这个问题: http://www.ver ...