JPA Batch update returned unexpected row count from update [0]; actual row count: 3; expected:1;问题解决

本是古典 何须时尚 2022-10-22 09:27 55阅读 0赞

问题描述:

Caused by: org.springframework.orm.jpa.JpaSystemException: Batch update returned unexpected row count from update [0]; actual row count: 3; expected: 1;

问题分析:

1、使用saveAll()方法时,该表没有设置主键约束,导致存在多条id相同的记录,导致更新报错。

解决办法:删除id相同相同的记录,保证一个id只有一条记录。

发表评论

表情:
评论列表 (有 0 条评论,55人围观)

还没有评论,来说两句吧...

相关阅读