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

参考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. 【转】eclipse内存设置,tomcat内存设置,查看内存大小

    原文网址:http://www.cnblogs.com/youngjoy/p/4239978.html 首先可以通过java/jdk/bin下的java visualVM查看eclipse的内存大小和 ...

  2. CPU acceleration status:HAXM must be updated(version 1.1.1<6.0.1)

    终于上手as了,感觉很爽 但是感觉也特闹心啊 还好有stackoverflow(这特么才是一个神奇的网站好吗) 废话少说 记录一下: 前面历经的磨难暂时不说了,就这个CPU acceleration ...

  3. HDU-2550 百步穿杨

    百步穿杨 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submi ...

  4. linux 以root用户登录ftp

    ftp默认禁止以root用户登录. 可以修改 /etc/ftpusers 文件,把root注释掉,即可以root用户登录ftp

  5. devi into python 笔记(三)callable getattr lambda表达式

    常用的函数:callable():如果所给参数是可调用的,返回True 不可调用返回Fasle.这里指的是否能调用说的是方法.类方法等有doc string的东西,一个单纯的字符串等就不算了. imp ...

  6. 编译Hadoop源码

    背景: 在阅读hadoop源代码过程中会发现部分类或者函数无法找到,这是由于Hadoop2.0使用了Protocol Buffers定义了RPC协议, 而这些Protocol Buffers文件在Ma ...

  7. 水leetcode 爬楼梯

    public class Solution { public int climbStairs(int n) { if(n==1) return 1; if(n==2) return 2; int pr ...

  8. JavaScript高级程序设计54.pdf

    过滤输入 对于一些浏览器,可以使用正则表达式里的text()测试用户按下的按键,Firefox和safari(3.1版本之前)会对向上向下.退格键和删除键触发keypress事件,在Firefox中, ...

  9. Poj 1151-Atlantis 矩形切割

    题目:http://poj.org/problem?id=1151 Atlantis Time Limit: 1000MS   Memory Limit: 10000K Total Submissio ...

  10. Spark RDD/Core 编程 API入门系列之动手实战和调试Spark文件操作、动手实战操作搜狗日志文件、搜狗日志文件深入实战(二)

    1.动手实战和调试Spark文件操作 这里,我以指定executor-memory参数的方式,启动spark-shell. 启动hadoop集群 spark@SparkSingleNode:/usr/ ...