異常積累:org.hibernate.StaleStateException
ERROR - Exception executing batch:
org.hibernate.StaleStateException: Batch update returned unexpected row count fr
om update [0]; actual row count: 0; expected: 1
ERROR - Could not synchronize database state with session
org.hibernate.StaleStateException: Batch update returned unexpected row count fr
om update [0]; actual row count: 0; expected: 1
不注意的話,還真的有點(diǎn)無所適從,Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
這個異常是由于主鍵設(shè)置為自增長,而在我們插入記錄的時候設(shè)置了ID的值導(dǎo)致的。看下我的Hibernate映射文件中ID的定義:
參考文章:http://hi.baidu.com/shirdrn/blog/item/adec1e82d067ddb86c81191c.html
不注意的話,還真的有點(diǎn)無所適從,Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
這個異常是由于主鍵設(shè)置為自增長,而在我們插入記錄的時候設(shè)置了ID的值導(dǎo)致的。看下我的Hibernate映射文件中ID的定義:
參考文章:http://hi.baidu.com/shirdrn/blog/item/adec1e82d067ddb86c81191c.html
Gavin
posted on 2012-04-18 15:33 GavinMiao 閱讀(10590) 評論(0) 編輯 收藏 所屬分類: 異常積累