A different object with the same identifier value was already associated with the session

org.springframework.dao.DuplicateKeyException: A different object with the same identifier value was already associated with the session : [com.chuai.pojo.User#4]; nested exception is org.hibernate.NonUniqueObjectException: A different object with the same identifier value was already associated with the session : [com.chuai.pojo.User#4]
在这里插入图片描述
在这里插入图片描述
原因:
不同的对象具有同一个session,在dao层操作之前清空session即可。

猜你喜欢

转载自blog.csdn.net/weixin_44142296/article/details/85055363
今日推荐