a different object with the same identifier value was already associated with the session
来源:互联网 发布:win7 64 php环境搭建 编辑:程序博客网 时间:2024/05/16 13:49
报下面这个错误,对hibernate的了解甚少,遇到了这个问题,记录一下吧。
HTTP Status 500 - a different object with the same identifier value was already associated with the session: [com.szu.beans.Subject#1]
type Exception report
message a different object with the same identifier value was already associated with the session: [com.szu.beans.Subject#1]
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.szu.beans.Subject#1]org.hibernate.engine.internal.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:686)org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:293)org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:239)org.hibernate.event.internal.DefaultUpdateEventListener.performSaveOrUpdate(DefaultUpdateEventListener.java:55)org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)org.hibernate.internal.SessionImpl.fireUpdate(SessionImpl.java:779)org.hibernate.internal.SessionImpl.update(SessionImpl.java:771)org.hibernate.internal.SessionImpl.update(SessionImpl.java:767)
代码,注意下面的第31行传入subject时会报错,如果将第31行改为return subjectDao.editSubjectIntrodution(subject2)即不报错了:
下图是 subjectDao.editSubjectIntrodution(subject2)里面的代码:
0 0
- 解决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
- 再次碰到: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错误
- HibernateSystemException: 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错误
- cache源码分析三 evacuate机制的实现
- Android利用tcpdump和wireshark抓取网络数据包
- cache源码分析四 初始化与元数据同步
- 好记性不如烂笔头
- Web前端开发面试题赋答案
- a different object with the same identifier value was already associated with the session
- Git生成密钥
- Java小贱人,我要征服你!
- hiho第二十七周
- Mac下android studio安装genymotion所遇到的坑
- Android项目中常用的工具类集(史上最全整理)
- 一起talk C栗子吧(第一百七十一回:C语言实例--关闭终端中的回显功能二)
- c语言 error redefinition of 'xxx' 解决
- hiho第二十六周