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 对象引用未保存的 ...
随机推荐
- FusionCharts 3.2.1 flash 图表展示、数据钻取
StackedColumn3DLineDY.swf 效果展示: 一.页面代码 <div id="chart2div" align="center" sty ...
- Gson ------ 实例演习
[本文范围]: 本文并非JSON知识讲解资料,亦非GSON知识讲解资料,而是通过实例让开发人员了解通过Gson如何使Java对象和Json对象进行相互转换. [JSON参考资料]: Json快速入门: ...
- WebView loadData出错(奇怪的设计)
今天遇到一个奇怪的问题. 我使用WebView加载一个网页. 方法1. 直接使用 loadUrl() 方法,没有问题.完全可以.方法2. 使用loadData()方法,出现问题,无法显示.方法3. ...
- CSS中背景图片定位方法
转自:http://www.ruanyifeng.com/blog/2008/05/css_background_image_positioning.html 作者: 阮一峰 日期: 2008年5月 ...
- C# 客户端判断是否安装office03、07或WPS
using Microsoft.Office.Interop.Excel;//转换为excel时,对比一下c#.需要引用此命名空间 using ET;//转换为wps时,相比看.需要引用此命名空间us ...
- python 零散记录(七)(上) 面向对象 类 类的私有化
python面向对象的三大特性: 多态,封装,继承 多态: 在不知道对象到底是什么类型.又想对其做一些操作时,就会用到多态 如 'abc'.count('a') #对字符串使用count函数返回a的数 ...
- 用户故事(User Story)
摘要: 一件用户通过系统完成他一个有价值的目标(买一罐饮料)的事.这样的过程就叫“用户案例(user case)”或者“用户故事(user story)”.本文描述了敏捷开发的技巧:如何以用户故事管理 ...
- 云之讯融合通讯开放平台_提供融合语音,短信,VoIP,视频和IM等通讯API及SDK。
云之讯融合通讯开放平台_提供融合语音,短信,VoIP,视频和IM等通讯API及SDK. undefined 全明星之极验证 - SendCloud undefined [转载]国内外几个主流的在线开发 ...
- chgrp、chown、chmod命令
讲解内容: 权限代号的含义如下: r:读写目录或文件的权限 read w :写入目录或文件的权限 write x :执行目录或文件的权限 -:删除目录或文件的权限 s:特殊权限,更改目录或文件 ...
- PC-修改IE 与 禁止修改IE
1.注册表编辑器1.1在Windows启动后1.2点击“开始”1.3“运行”菜单项1.4在“打开”栏中键入“regedit”1.5然后按“确定”键 2.首页项2.1展开注册表到“HKEY_LOCAL_ ...