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.apache.cxf.interceptor.Fault: No such operation
webservice错误,访问的时候加后缀wsdl即可,如:http://localhost:9000/HelloWorld?wsdl
- Win7家庭版包“已停止工作”
在VS2010上依据接口,写了个WiFi共享软件,在Win7旗舰班上正确无误,而在却在Win7家庭版上运行不了,报“已停止工作”错误. 解决方法: 1.下载安装vs2010对应的.Net平台:Micr ...
- set_include_path — 设置 include_path 配置选项为当前脚本设置 include_path 运行时的配置选项。
说明 string set_include_path ( string $new_include_path ) 为当前脚本设置 include_path 运行时的配置选项. 参数 new_includ ...
- 微信支付 APP 支付方式的服务器端处理程序
对于微信的APP的支付,客户服务说只能通过微信开放平台申请.后来在公众帐号确实发现了证据: 微信支付在申请的时候就比较严(麻烦),对服务类的一些支付,本来商品就是虚拟的,所以需要将商品描述的比较详细 ...
- ci中简单实用的权限管理
实用的权限管理 对多数网站来说,使用完整的rbac权限管理杀鸡用牛刀绝对的吃力不讨好,因为我们只是简单分角色然后对角色进行管理行使其相对于的角色赋予的权限; 在实际的开发中用位运算来对权限进行验证是十 ...
- combox绑定后添加自定义列
DataTable dt = shUBll.FindAllByWhere(""); DataRow dr = dt.NewRow(); dr["SUID"] = ...
- 提高 Linux 上 socket 性能
http://www.cnblogs.com/luxf/archive/2010/06/13/1757662.html 基于Linux的Socket网络编程的性能优化 1 引言 随着In ...
- MySQL日期时间函数大全
DAYOFWEEK(date) 返回日期date是星期几(=星期六,ODBC标准) mysql> select DAYOFWEEK('1998-02-03'); WEEKDAY(date) 返回 ...
- Mybaits 之根据集合查询和逗号分隔的子查询
这是我们的mapper要根据传入一个集合进行查询: List<ExtKeywordCategory> findListByIds(List<ExtKeywordFkCategory& ...
- ListView Animation
简单介绍一下4种动画效果方式AnimationSet set = new AnimationSet(false); Animation animation = new AlphaAnimation(0 ...