使用了SpringBoot + JPA。
在使用相关Repository saveAll的时候,报下面的错误:
a different object with the same identifier value was already associated with the session
经过DEBUG发现,原来是因为 saveAll里面的List中的数据的字段全部为null,导致了主键冲突。
所以,上面报错的意思就是主键冲突,需要检查下需要持久化的数据。
博客讲述使用Spring Boot + JPA时,调用Repository saveAll方法报错。经DEBUG发现,是saveAll里List数据字段全为null,导致主键冲突。提示报错意味着主键冲突,需检查待持久化的数据。
使用了SpringBoot + JPA。
在使用相关Repository saveAll的时候,报下面的错误:
a different object with the same identifier value was already associated with the session
经过DEBUG发现,原来是因为 saveAll里面的List中的数据的字段全部为null,导致了主键冲突。
所以,上面报错的意思就是主键冲突,需要检查下需要持久化的数据。

被折叠的 条评论
为什么被折叠?