HibernateSystemException: a different object with the same identifier value was already associated w
来源:互联网 发布:windows 域管理 编辑:程序博客网 时间:2024/05/23 18:44
HibernateSystemException: a different object with the same identifier value was already associated with the session.
这个错误是因为在hibernate的session一级缓存中存在一个被缓存的对象A,并且有另一个不在一级缓存中的对象B和A的标识符相同,但是它们不是同一个对象,即引用不相同,所以会抛出此异常。
以下代码也会抛出异常:
Image i = new Image();
i.setId(1);
Image j = session.load(Image.class,1);
session.delete(i);
因为i和j都是Image对象,并且有相同的标识符1,但是在session中的对象j和不在session中的对象i是两个对象,它们的引用不相同。因此会抛出异常!
解决办法:可以用session.clear()清一下session缓存,再进行hibernate session相关的操作。
- HibernateSystemException: a different object with the same identifier value was already associated w
- HibernateSystemException: a different object with the same identifier value was already associated with the session.
- org.springframework.orm.hibernate3.HibernateSystemException: a different object with the same identifier value was already assoc
- 解决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错误
- 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
- android 比较靠谱的图片压缩
- vmware设置
- Yii自动生成项目
- archlinux安装gdm
- Android dialog设置无背景
- HibernateSystemException: a different object with the same identifier value was already associated w
- Delphi中ShellExecute的妙用
- DC-DC升压(BOOST)电路原理
- 中断驱动方式和轮询polling方式(也叫做程序控制方式)
- C#源码500份
- 限制文本框的输入
- [SharePoint 2010] 初识SharePoint BI -- PerformancePoint Service
- Scramble String
- Android 菜单(OptionMenu)大全 建立你自己的菜