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

问题描述:

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只有一条记录。

猜你喜欢

转载自blog.csdn.net/qq_38974638/article/details/115196102