org.hibernate.ObjectDeleteException
来源:互联网 发布:自动语音阅读软件 编辑:程序博客网 时间:2024/06/06 20:18
org.hibernate.ObjectDeleteException: deleted object would be re-saved by cascade (remove deleted object from association):[com.hibernate.domain.Student#4]
错误分析:
1、该错误发生在两者或两者之上的关系
2、在Claaes.hbm.xml文件中
<set name="students" cascade="save-update">
说明classes与student有级联关系
3、
Set<Student> students = classes.getStudents(); for(Student student:students){ if(student.getSid().longValue()==4){ session.delete(student); } }
从上述代码可以看出,student是通过classes级联产生的
这个时候,因为有级联,所以hibernate内部不会删除student
解决方案:
解除classes与student之间的关系
0 0
- org.hibernate.ObjectDeleteException
- hibernate org.hibernate.TypeMismatchException
- hibernate org.hibernate.PropertyNotFoundException
- Hibernate org.hibernate.TypeMismatchException异常
- Hibernate 异常org.hibernate.LazyInitializationException
- Hibernate org.hibernate.TypeMismatchException异常 .
- hibernate org.hibernate.DuplicateMappingException错误
- hibernate中 org.hibernate.MappingException
- hibernate 异常 org.hibernate.MappingException
- org.hibernate.PropertyAccessException:
- org.hibernate.NonUniqueObjectException
- 错误:org.hibernate.LazyInitializationException
- org.hibernate.PropertyNotFoundException
- org.hibernate.ObjectNotFoundException
- org.hibernate.exception.SQLGrammarException
- org.hibernate.id.IdentifierGenerationException:
- org.hibernate.NonUniqueResultException
- org.hibernate.exception.SQLGrammarException
- iOS 文件操作
- mac更新系统后myeclipse打不开,需要安装java SE的解决办法
- cocos2d-x 资源路径研究
- 显式调用构造函数产生的悲剧
- Win7系统下,VS2010关于OpenCV2.0和OpenCV2.4.3的配置
- org.hibernate.ObjectDeleteException
- 初学菜鸟的学习日记——二叉树(JAVA)
- 封装php的Log类
- HDU 4218 IMBA?
- POJ_2312_BFS:priority_queue -- Battle City
- linux查看命令
- Shell编程入门
- UVa 11995 I Can Guess the Data Structure!
- Android调用系统相机拍照后不进入预览确认