Batch update returned unexpected row count from 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的主键生成策略,而在程序中又主动去设置了主键值。
比如使用了uuid,但在程序中设置了值,或者像网上所说数据库设置自动增长,而程序中设置了值。
对于hibernate的更多异常解决方法: