在Hibernate多表操作的“一对多|多对一”中,初学Hibernate的小伙伴可能在学习过程中会遇到这样的错误信息,然后我也遇到了

org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: ...............


这个错误可能是由以下原因引起的:

1、save顺序不正确(百度得到的结果)

比如公司表和职员表,职员表存有公司的ID外键,是一对多的关系。在进行操作的时候应该是先执行公司表的save操作,再执行职员表的save操作。


2、在执行一对多的添加操作时,未对新增的对象的实行save操作。(自己在写demo的犯的错误)



最后祝大家早日处理好程序的异常。

Hibernate常见错误之save the transient instance before flushing相关推荐

  1. 解决object references an unsaved transient instance - save the transient instance before flushing 的错误

    异常信息: Caused by: org.hibernate.TransientPropertyValueException: object references an unsaved transie ...

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

    问题内容: 在一个hibernate项目中,为一个Model类添加一个多对一的配置 当表单中选择数据时对其多对一对象进行保存操作,没有选择的话则不对其做任何操作,如下面代码:当Attach不为空的情况 ...

  3. object references an unsaved transient instance - save the transient instance before flushing 解决过程。

    前言 本篇博客记录一个Spring JPA报错的解决方案.这个报错源自于一个需求的的改动,由于原始的接口执行过于缓慢,所以要改造成为异步通知模式,也因此遇到了这个报错,浪费了一上午时间. 情景还原 由 ...

  4. 关于object references an unsaved transient instance - save the transient instance before flushing的解决方法

    关于object references an unsaved transient instance - save the transient instance before flushing的解决方法 ...

  5. object references an unsaved transient instance - save the transient instance before flushing

    刚开是在写项目的时候,去掉了很多jar包所以才会出现这个问题 Struts Problem Report Struts has detected an unhandled exception: Mes ...

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

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

  7. object references an unsaved transient instance - save the transient instance before flushing .

    http://blog.csdn.net/zdwzzu2006/article/details/7552234 异常1:not-null property references a null or t ...

  8. Hibernate中的级联策略和object references an unsaved transient instance - save the transient instance before

    本片博文整理关于Hibernate中级联策略cascade和它导致的异常: Exception in thread "main" org.hibernate.TransientOb ...

  9. hibernate常见错误汇总

    请尊重别人的劳动成果,转载请指明:http://blog.csdn.net/tianyazaiheruan 1. 插入失败,某一字段没有默认值:insert fail:filed depid does ...

最新文章

  1. RelativeLayout不能居中的解决的方法
  2. 在 Ubuntu 上安装 Android Studio
  3. 如何解决get和post乱码问题?
  4. java -cp 引用多个包_javac编译单文件、多文件引入jar包、-cp解决无法加载主类问题...
  5. [EDA]FPGA/CPLD 设计流程步骤及步骤概念
  6. STL运用的C++技术(6)——函数对象
  7. 玩转Powerpoint2010的视频
  8. 数值分析(第五版) 第二章知识点总结
  9. netty解决方法 io.netty.util.IllegalReferenceCountException: refCnt: 0, increment: 1
  10. wamp2.2c集成环境搭建网站问题总结
  11. chrome安装JSONview插件,即可在浏览中查看json文件
  12. 最简易的流水记账软件分享
  13. 没有找到MSVCR100.dll解决方法
  14. 计算机辅助设计与制造考试重点,2016计算机辅助设计与制造复习内容
  15. 测试用例需要包含哪些内容
  16. NX二次开发(Python)-UIStyler-选择体和按钮操作
  17. 关于iPhone边缘触摸延迟现象
  18. 六、DOM(上) - 章节课后练习题及答案
  19. Git如何获取帮助(命令解释/命令详情)?
  20. AI成为硬件增效“杀手锏”,百度输入法的「To B」探索

热门文章

  1. 数据压缩:protobuf 的使用
  2. WordPress英文版改中文版
  3. 【面试题】973- 一篇由简到难的 Vue 面试题+详解答案
  4. TEE OS的一点闲言碎语
  5. 通达信股票接口下单界面是什么?
  6. JAVA毕业设计毕业生离校管理系统计算机源码+lw文档+系统+调试部署+数据库
  7. 美国演员选拔公司泄露了超26万人的隐私数据
  8. UI设计师月薪大概是多少 一般能工作到多少岁
  9. 使用Python打造基本WEB漏洞扫描器(一) 网站爬虫+SQL注入检测
  10. 使用MyBatis-Plus时日志里面打印的SQL语句后出现WHERE条件为“null = ?”的情况