更改主键生成策略后报的错
ERROR [org.hibernate.jdbc.AbstractBatcher] - 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)
Caused by: org.hibernate.StaleStateException: Batch update returned unexpected r
ow count from update [0]; actual row count: 0; expected: 1
备注:一开始我们使用native数据库自动生成的主键。后改成assigned手动添加主键。更改后台代码再运行时报的错。
解决方案:原因是自己的粗心,没有save对象baseDao.save(cardDistribute);,而是调用的update方法。