org.hibernate.NonUniqueObjectException: A different object with the same identifier解决方法
2014-11-02 17:33
615 查看
比如在编辑用户时,编辑页面提交后,表单值会生成一个user vo;并从数据库查询出该user的原属性值( user po),然后两个比对判断哪些属性发生变化。
然后再将user vo update进入数据库,此时会报错:
org.hibernate.NonUniqueObjectException: A different object with the same identifier value was already associated with the session : [com.model.UserVO#34re]
解决办法有两种:
1、session.evict(po)然后再session.update(vo)
2、session.merge(vo)
然后再将user vo update进入数据库,此时会报错:
org.hibernate.NonUniqueObjectException: A different object with the same identifier value was already associated with the session : [com.model.UserVO#34re]
解决办法有两种:
1、session.evict(po)然后再session.update(vo)
2、session.merge(vo)
相关文章推荐
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the sessio
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was ...
- org.hibernate.NonUniqueObjectException: A different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the sessio
- org.hibernate.NonUniqueObjectException: A different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the sessio
- org.hibernate.NonUniqueObjectException:a different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException: A different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the sessio
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the sessio
- hibernate错误:org.hibernate.NonUniqueObjectException: a different object with the same identifier valu
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was alread---------程序报错
- org.hibernate.NonUniqueObjectException: A different object with the same identifier value was alread
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was alread
- 报错信息:Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier
- .NonUniqueObjectException: a different object with the same identifier等的解决
- org.hibernate.NonUniqueObjectException: a different object with the same ide
- org.hibernate.NonUniqueObjectException: a different object with the same ide