a different object with the same identifier value was already associated with the session
2009-06-03 10:57
441 查看
a different object with the same identifier value was already associated with the session
出现异常的代码:
修改后没问题的代码:
参见:http://guoxubo.javaeye.com/blog/363019
出现异常的代码:
session.beginTransaction(); //开启事务 String hql="from MessageForm m where m.msg_id='"+msg_id+"'"; list=session.createQuery(hql).list(); MessageForm myform=(MessageForm)list.get(0); myform.setMsg_back(msgform.getMsg_back()); myform.setMsg_back_time(msgform.getMsg_back_time()); session.update(myform); session.getTransaction().commit(); //提交事务
修改后没问题的代码:
session.beginTransaction(); //开启事务 String hql="from MessageForm m where m.msg_id='"+msg_id+"'"; list=session.createQuery(hql).list(); MessageForm myform=(MessageForm)list.get(0); myform.setMsg_back(msgform.getMsg_back()); myform.setMsg_back_time(msgform.getMsg_back_time()); session.update(myform); session.save(myform); session.getTransaction().commit(); //提交事务
参见:http://guoxubo.javaeye.com/blog/363019
相关文章推荐
- a different object with the same identifier value was already associated with thesession
- 错误: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
- a different object with the same identifier value was already associated with the session
- a different object with the same identifier value was already associated with the session:
- 再次碰到:a different object with the same identifier value was already associated with the session
- 错误中学习--a different object with the same identifier value was already associated with the session
- a different object with the same identifier value was already associated with the session
- a different object with the same identifier value was already associated with the session
- a different object with the same identifier value was already associated with the session
- 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错误方式及解决方法
- 解决 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
- a different object with the same identifier value was already associated with the session
- a different object with the same identifier value was already associated with the session
- a different object with the same identifier value was already associated with the session
- a different object with the same identifier value was already associated with the session
- a different object with the same identifier value was already associated with the session
- a different object with the same identifier value was already associated withthe session异常解决方案