异常积累: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


不注意的话,还真的有点无所适从,Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
这个异常是由于主键设置为自增长,而在我们插入记录的时候设置了ID的值导致的。看下我的Hibernate映射文件中ID的定义:
原文地址:https://www.cnblogs.com/549294286/p/3481380.html