a different object with the same identifier value was already associated with the session一个经典的hibernate错误:a different object with the same identifier value was already associated with the session xxxxhibernate3.0以上使用merge()来合并两个session中的同一对象具体解决方案就是看以下代码 public Object getDomain(Object obj) { getHibernateTemplate().refresh(obj); return obj; } public void deleteDomain(Object obj) { obj = getHibernateTemplate().merge(obj); getHibernateTemplate().delete(obj); }解决a different object with the same identifier value was already associated with the session错误 这个错误产生原因相信大家都知道,因为在hibernate中同一个session里面有了两个相 同标识但是是不同实体,当这时运行saveOrUpdate(object)操作的时候就会报这个错误。