Exception executing batch:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:85)
at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:70)
at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:90)
[color=darkred]原因分析一:这里估计是因为在映射时,id="increament",而在我们持久化的时候,又给它指定了值的原因。[/color]
[color=darkred]原因分析二:估计是在一对一的时候,有这样的cascade="all"属性,在持久化是会执行update数据,若是又setId()的值,也会出现这样的情况。 [/color]