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 对象引用未保存的 ...
随机推荐
- CentOS升级Python的方法
centOS内核版本为:3.10.101-1.el6.elrepo.x86_64 1,下载Python安装包 wget http://www.python.org/ftp/python/2.7.6/P ...
- Win7,8的上帝模式文件夹 GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
新建一文件夹,命名为:“GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}”, 创建后双击进入,可以看到计算机所有的配置选项信息.
- bzoj 1069 [SCOI2007]最大土地面积(旋转卡壳)
1069: [SCOI2007]最大土地面积 Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2277 Solved: 853[Submit][Stat ...
- [ZETCODE]wxWidgets教程五:布局管理
本教程原文链接:http://zetcode.com/gui/wxwidgets/layoutmanagement/ 翻译:瓶哥 日期:2013年12月4日星期三 邮箱:414236069@qq.co ...
- python Day 2 - 编写数据库模块
在一个Web App中,所有数据,包括用户信息.发布的日志.评论等,都存储在数据库中.在awesome-python-app中,我们选择MySQL作为数据库. Web App里面有很多地方都要访问数据 ...
- 一次服务器CPU占用率高的定位分析
现象: 当前项目启动一段时间,有一个服务导致CPU使用率持续超过30% 环境:Windows 7, CPU: 8核, 内存: 8g内存 定位过程: 启动项目,查看Java进程ID 查看Event P ...
- .NET中ToString()的用法
一.数字转换到字符串 格式说明符 说明 示例 输出 C 货币 2.5.ToString(& ...
- 搭建Struts框架
搭建Struts框架 新建项目 [file]-[new]-[web project] 在弹出的对话框中对项目进行命名,点击[finish] 新建项目-> 点击项目右键-> MyEclips ...
- [D3] 8. Margins
If you want ot add margins, should append graphics container in svg var svg = d3.select('#chartArea' ...
- oracle3
查看表结构 DESC emp; 查询所有列 SELECT * FROM dept; 切忌动不动就用select * set timing on; 打开显示操作时间的开关,在下面显示查询时间. CREA ...