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編輯界面
這樣便可。