a different object with the same identifier value was already associated with the session.

来源:互联网 发布:网络小贷 资金来源 编辑:程序博客网 时间:2024/06/10 07:26

session.update(Object  object)方法来对数据库进行更新的。而该方法在执行时,如果在session的缓冲区中存在与传入对象object有相同id的PO对象的话,就会抛出a different object with the same identifier value was already associated with the session.


解决办法:


用hql的方式直接对数据库进行修改

super.queryHql("update Customer u set u.email = ? where u.id = ?", obj);


参考文章

http://excon.iteye.com/blog/1085591

 

本文出自 “点滴积累” 博客,请务必保留此出处http://tianxingzhe.blog.51cto.com/3390077/1670923

0 0
原创粉丝点击