我的问题出在,删除的对象对应的表中有一个外键,关联着另外一个表,可是另外一个表中没有数据,所以报了这个错误。

参考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的更多相关文章

  1. ManyToMany【项目随笔】关于异常object references an unsaved transient instance

    在保存ManyToMany  时出现异常: org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.Tran ...

  2. Hibernate的一个问题object references an unsaved transient instance - save the transi5

    1 我做了一对多和多对一的双向关联关系,在User这一方@ManyToOne已经设置了级联Cascade,这样在测试程序中保存User时,Group也应该自动保存,为什么会抛出以下的异常: (我是按着 ...

  3. 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 ...

  4. object references an unsaved transient instance【异常】

    [异常提示] TransientObjectException: object references an unsaved transient instance -save the transient ...

  5. object references an unsaved transient instance - save the transient instance before flushing异常问题处理

    一.异常:org.hibernate.TransientObjectException: object references an unsaved transient instance - save ...

  6. 三大框架常遇的错误:hibernate : object references an unsaved transient instance

    hibernate : object references an unsaved transient instance 该错误是操作顺序的问题,比如: save或update顺序问题---比方学生表和 ...

  7. Exception in thread "main" org.hibernate.TransientObjectException: object references an unsaved tran

    今天在使用一对多,多对一保存数据的时候出现了这个错误 Hibernate错误: Exception in thread "main" org.hibernate.Transient ...

  8. 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(参考资料: ...

  9. object references an unsaved transient instance save the transient instance before flushing

    object references an unsaved transient instance save the transient instance before flushing 对象引用未保存的 ...

随机推荐

  1. JBPM4.4部署到tomcat6异常解决办法

    java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.ser ...

  2. Centos6.4 mysql安装与配置

    安装命令: yum install mysql #安装客户端 yum install mysql-server #安装服务器 yum install mysql-devel #安装开发库 安装完成后, ...

  3. SQL SERVER 的 INFORMATION_SCHEMA 的使用

    ------------------------------------------------------- 第一个查询看看库里有多少个表,表名等 select * from INFORMATION ...

  4. HTML5与CSS3权威指南.pdf4

    拖放API HTML5实现了直接拖放操作API,简化HTML4利用mousedown.mousemove等事件实现的操作 实现拖放的步骤 1要将被拖动元素的draggable属性设置为true,img ...

  5. admin-openrc

    #!/bin/bash # To use an Openstack cloud you need to authenticate against keystone, which # returns a ...

  6. js修改编辑器内容、修改iframe子页内容

    $('#question-stem-uploader').on('click','',function(){ //获取编辑器内容(ke-edit-iframe: 编辑器iframe的classm名称) ...

  7. 初识Android

    #Android项目的目录结构 Activity:应用被打开时显示的界面 src:项目代码 R.java:项目中所有资源文件的资源id Android.jar:Android的jar包,导入此包方可使 ...

  8. ActiveForm

    ActiveForm要和Model一起使用 我想在你的控制器的action中,至少应该这么写: /*action*/ $model = new Comments(); //实例化 Comments m ...

  9. CSS学习之盒子模式

    从CSS角度来看,页面上每个元素都是一个盒子,不管是块元素还是内敛元素等.而这个盒子由四个部分组成.内容区,补白,边框,边界,下面来介绍下这四种元素. 1 内容 每个元素都是以某些内容开始的,比如文本 ...

  10. jsp+urlrewrite实现html分页简单粗暴实现

    今天去检查一同事写的一分页实现,看了有点郁闷,都说了要换成html实现方便搜索引擎收录,他还是用的js,真是晕.还得帮他解决 好吧.言归正传,我在他的基础上粗暴的修改了下,达到了基本的效果,带数字分页 ...