Data truncation: Truncated incorrect DOUBLE value错误的解决方案

Data truncation: Truncated incorrect DOUBLE value错误的解决方案:

当在修改某条单位记录时,发生了Data truncation: Truncated incorrect DOUBLE value错误,该如何解决:

步骤1:找到单位对应的实体对象的hbm配置文件,如unit.hbm.xml,person.hbm.xml

步骤2:把配置文件里的一对多的属性全部去掉,或者多对一的属性去掉,如

unit.hbm.xml去掉的内容如下:

<set name="persons">
<key>
<column name="unit"/>
</key>
<one-to-many class="com.cosl.po.Person"/>
</set>

<set name="userrelations">
<key>
<column name="cunit"/>
</key>
<one-to-many class="com.cosl.po.Userrelation"/>
</set>

person,hbm.xml去掉的内容如下:

<many-to-one
name="postgroup"
class="Postgroup" >

<column name="postgroup" />
</many-to-one>

<many-to-one
name="depart"
class="Depart" >

<column name="depart" />
</many-to-one>

以后台person对象为例,person的depart属性不为空,但id为null,故更新person时会出错。

给后台传值的person编辑界面

这样便可。

时间: 2024-08-06 09:30:00

Data truncation: Truncated incorrect DOUBLE value错误的解决方案的相关文章

Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: &#39;L

1.错误描述 [ERROR:]2015-06-08 09:49:42,523 [异常拦截] org.hibernate.exception.DataException: error executing work at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:69) at org.hibernate.exception.internal.Stand

Mybatis Data truncation: Truncated incorrect DOUBLE value: &#39;*&#39;

具体异常信息如下: org.springframework.dao.DataIntegrityViolationException: ### Error querying database. Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: '*' 错误代码如下: 解决办法: 在mybatis中的遇到这种拼接的情况,应该使用concat函数 数据库用的是mys

mysql执行update语句时报错:Data truncation: Truncated incorrect DOUBLE value: &#39;null&#39;

出现这个问题的原因网上有说是update的参数连接符要用,而不是and,但是我遇到的不是这个. 我出现问题的原因是,在update语句的where中varchar类型的字段我直接用了数字类型 update address set province = '北京' where userId = 250; userId是varchar类型的,报错Data truncation: Truncated incorrect DOUBLE value: 'null' 改成这样就可以了 update addre

mysql 1292错误:Warning 1292 Truncated incorrect DOUBLE value:

问题:执行如下语句时出现大量Warning 1292 mysql> UPDATE show_info INNER JOIN show_like ON show_like.show_id = show_info.show_id SET show_info.status = 0 WHERE show_like.show_id = 1 AND show_like.cid = 'taobao_mecity'; Query OK, 0 rows affected, 99 warnings (0.00 se

Truncated incorrect DOUBLE value

我有点傻…… sql update语法,修改的字段之间要用,连接,而不是and 否则就会报错Truncated incorrect DOUBLE value…… 如: update teacher set IMAGE_URL = #{1} and UPDATE_TIME=now() where TEACHER_MOBILE = #{0}  错误 update teacher set IMAGE_URL = #{1},UPDATE_TIME=now() where TEACHER_MOBILE =

Truncated incorrect DOUBLE value: &#39;NO_REFUND&#39;

解决办法:Mysql中,如果一个字段是字符串,则一定要加单引号 问题原因: `item_refund_state` varchar(255) NOT NULL item_refund_state字段的类型是varchar但where条件中使用了item_refund_state=0 如果where条件中tid对应item_refund_state字段值不是字符串0,而是'NO_REFUND'之类的字符串时,就会报下面的错 Truncated incorrect DOUBLE value: 'NO

Truncated incorrect DOUBLE value: &#39;deleted&#39;

注意 sql update的语法啊 已经被这个问题纠结过N次了, 每次都搞得头晕眼花 sql = "update netpro_sys_subindex set index_states='deleted' and snapshot_name='"+ snapshotName +"' where sid="+ tmpSid +" and del_flg=0"; statement.executeUpdate(sql); 不能用and啊,应该是,

mysql - Truncated incorrect DOUBLE value: &#39;undefined&#39;

mysql - Truncated incorrect DOUBLE value: 'undefined' 我是怎么遇到这个问题的? 我要从多个表里,查询统计数据,保存到统计表里,需要执行下面这种结构的 sql 语句: insert into table1 select (select count(*) from t1 where ...) c1, select (select count(*) from t1 where ...) c1 单独执行 select (select count(*)

mysql修改Truncated incorrect DOUBLE value:

UPDATE shop_category SET name = 'Secolul XVI - XVIII' AND name_eng = '16th to 18th centuries' WHERE category_id = 4768 category_id mediumint(8) name varchar(250) name_eng varchar(250) 执行报错 1292 - Truncated incorrect DOUBLE value: 'Secolul XVI - XVIII