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
转载于:https://blog.51cto.com/tianxingzhe/1670923