hibernate 对象状态异常:object references an unsaved transient instance - save the transient instance before flushing
我的问题出在,删除的对象对应的表中有一个外键,关联着另外一个表,可是另外一个表中没有数据,所以报了这个错误。
参考http://www.cnblogs.com/onlywujun/archive/2013/04/10/3012719.html
如果关联的外键可以为空,这时需要修改配置文件。加上红色的字即可。将not-null='true'去掉
<many-to-one name="post" class="对象" fetch="select" cascade="save-update,persist">
<column name="post" />
</many-to-one>
参考:http://blog.csdn.net/zdwzzu2006/article/details/7552234
hibernate 对象状态异常:object references an unsaved transient instance - save the transient instance before flushing的更多相关文章
- ManyToMany【项目随笔】关于异常object references an unsaved transient instance
在保存ManyToMany 时出现异常: org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.Tran ...
- Hibernate的一个问题object references an unsaved transient instance - save the transi5
1 我做了一对多和多对一的双向关联关系,在User这一方@ManyToOne已经设置了级联Cascade,这样在测试程序中保存User时,Group也应该自动保存,为什么会抛出以下的异常: (我是按着 ...
- ERROR org.hibernate.internal.SessionImpl - HHH000346: Error during managed flush [object references an unsaved transient instance - save the transient instance before flushing: cn.itcast.domain.Custom
本片博文整理关于Hibernate中级联策略cascade和它导致的异常: Exception in thread "main" org.hibernate.TransientOb ...
- object references an unsaved transient instance【异常】
[异常提示] TransientObjectException: object references an unsaved transient instance -save the transient ...
- object references an unsaved transient instance - save the transient instance before flushing异常问题处理
一.异常:org.hibernate.TransientObjectException: object references an unsaved transient instance - save ...
- 三大框架常遇的错误:hibernate : object references an unsaved transient instance
hibernate : object references an unsaved transient instance 该错误是操作顺序的问题,比如: save或update顺序问题---比方学生表和 ...
- Exception in thread "main" org.hibernate.TransientObjectException: object references an unsaved tran
今天在使用一对多,多对一保存数据的时候出现了这个错误 Hibernate错误: Exception in thread "main" org.hibernate.Transient ...
- object references an unsaved transient instance - save the transient instance before flushing错误
异常1:not-null property references a null or transient value解决方法:将“一对多”关系中的“一”方,not-null设置为false(参考资料: ...
- object references an unsaved transient instance save the transient instance before flushing
object references an unsaved transient instance save the transient instance before flushing 对象引用未保存的 ...
随机推荐
- WCF简单教程
WCF是DotNet体系中很重要的一项技术,但是组内很多组员通过书籍自学的时候 感觉涉及面太广.配置文件太复杂,新名词太多.抓不到头绪,有感于此,决定进行一次组内技术培训,顺便把培训讲义整理到blog ...
- Ice_cream’s world III--2122
Ice_cream’s world III Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- HDU-3790 最短路径问题
最短路径问题 Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submis ...
- SQLServer的ISNULL函数和Mysql的IFNULL函数
SQL Serve的ISNULL函数: ISNULL(check_expression,replacement_value) 1.check_expression与replacement_value的 ...
- Ubuntu修改源
linux里的源,简单理解就是你用 apt-get 命令去下载安装软件时,系统去哪里找这个软件.去的那个位置就是源. linux默认的源是国外的,下载速度比较慢,可以修改为国内的一些好的源地址,例如网 ...
- ajax向后台传值
function save_person(){ //保存个人信息编辑 var data = getFormJson(".row"); //获取表单数据 $.post(clerk_u ...
- ACM2031_进制转换(使用了递归,代码超少的啦!!)
进制转换 Problem Description 输入一个十进制数N,将它转换成R进制数输出. Input 输入数据包含多个测试实例,每个测试实例包含两个整数N(32位整数)和R(2<=R& ...
- Java集合类详解
集合类说明及区别Collection├List│├LinkedList│├ArrayList│└Vector│ └Stack└SetMap├Hashtable├HashMap└WeakHashMap ...
- HDU 2876 Ellipse, again and again
转载请注明出处:http://blog.csdn.net/u012860063?viewmode=contents 题目链接:http://acm.hdu.edu.cn/showproblem.php ...
- Android 中 更新视图的函数ondraw() 和dispatchdraw()的区别
绘制VIew本身的内容,通过调用View.onDraw(canvas)函数实现 绘制自己的孩子通过dispatchDraw(canvas)实现 View组件的绘制会调用draw(Canvas canv ...