错误原因:
在调用hibernate存储数据时,需要将数据库中表对应的持久类对象作为参数传递。如果这时的对象中有其他的表字段属性并且是引用对象类型,那么这个属性必须是持久态或者是null的,瞬时态和脱管态都会报错。我这次报错就是因为在订单对象中包含了其他对象,并且这些对象不为null。
如果包含的对象的数据用不到的话,最简便的解决办法就是把包含的对象全部置为null。
如果用得到对象中的数据,那么调用持久层的方法重新查询出对应的对象,此对象此时为持久态,在重新赋值到要保存的对象中即可。

原文链接:https://blog.csdn.net/sinat_39789638/article/details/78208481

jpa报错object references an unsaved transient instance的更多相关文章

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

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

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

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

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

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

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

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

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

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

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

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

  8. object references an unsaved transient instance - save the transient instance before flushing: com.jspxcms.core.domain.ScTeam

    object references an unsaved transient instance - save the transient instance before flushing: com.j ...

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

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

随机推荐

  1. Android中实现照片滑动时左右进出的动画的xml代码

    场景 Android中通过ImageSwitcher实现相册滑动查看照片功能(附代码下载): https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/det ...

  2. 【转】Makefile步步为营

    Makefile步步为营 本目录主要包含Makefile一步步递进学习的示例代码 makefile代码实例:https://www.lanzous.com/i9m9npi step0:Makefile ...

  3. 纪中某日c组模拟赛 2314. 最短路

    2314. 最短路 (File IO): input:dti.in output:dti.out 时间限制: 1000 ms  空间限制: 262144 KB  具体限制   Goto Problem ...

  4. echarts--可拖动的曲线图

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. JMeter性能监控插件PerfMon Metrics Collector

    Jmeter性能监控插件由客户端插件和服务器端程序组成. 官方文档及插件下载地址https://jmeter-plugins.org/wiki/PerfMon/ 将插件 plugins-manager ...

  6. ArcGIS Engine开发碰到问题及解决方式

    1.问题描述——运行提示:ArcGIS version not specified. You must call RuntimeManager.Bind before creating any Arc ...

  7. 8maven配置多个项目之间的依赖

    首先创建两个项目进行测试依赖 创建一个HelloWorld2项目,一个HelloWorld类里面有一个sayHello的方法 然后再创建一个HelloWorldTime项目,一个SayHelloWor ...

  8. C#设计模式学习笔记:(2)工厂方法模式

    本笔记摘抄自:https://www.cnblogs.com/PatrickLiu/p/7567880.html,记录一下学习过程以备后续查用. 一.引言 接上一篇C#设计模式学习笔记:简单工厂模式( ...

  9. css3基础-选择器+边框与圆角+背景与渐变

    Css3选择器相关: section > div直接子元素选择器 div + article相邻兄弟选择器(在元素之后出现) div ~ article通用兄弟选择器(在元素之后出现) 属性选择 ...

  10. HTML表格概念、语法、操作、案例

    创建两行三列表格 <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...