错误原因:

  new了一个新对象,在未保存之前将它保存进了一个新new的对象(也即不是持久态)。

解决办法:

  在保存或更新之前把这个对象查出来(这样就是一个持久态)

  <set name="proList" cascade="all">
     <key column="product_type"></key>
    <one-to-many class="cn.test.entity.Product"/>
  </set>

将cascade中的值设置为all就可以了

save the transient instance before flushing错误解决办法的更多相关文章

  1. save the transient instance before flushing错误解决办法 【待完善】

    近日在项目中遇到以下错误,着实郁闷了一把: org.hibernate.TransientObjectException: object references an unsaved transient ...

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

  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. org.unsaved transient instance - save the transient instance before flushing: bug解决方案

    最近开发和学习过程中,遇到很多零碎的知识点,在此简单地记录下: 1.遇如下bug: org.unsaved transient instance - save the transient instan ...

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

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

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

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

  8. hibernate 对象状态异常:object references an unsaved transient instance - save the transient instance before flushing

    我的问题出在,删除的对象对应的表中有一个外键,关联着另外一个表,可是另外一个表中没有数据,所以报了这个错误. 参考http://www.cnblogs.com/onlywujun/archive/20 ...

  9. MySQL之Field‘***’doesn’t have a default value错误解决办法

    这篇文章主要介绍了MySQL之Field‘***’doesn’t have a default value错误解决办法,需要的朋友可以参考下 今天,中国博客联盟有博友反馈,zgboke.com无法提交 ...

随机推荐

  1. Coursera-吴恩达机器学习课程笔记-Week3

    logistic regression Binary classification problems logistic regression 是一个分类算法 Hypothesis function d ...

  2. elasticsearch数据组织结构

    elasticsearch数据组织结构 1.      mapping 1.1.    简介 mapping:意为映射关系,特别是指组织结构.在此语境中可理解为数据结构,包括表结构,表约束,数据类型等 ...

  3. POJ3264 Balances Lineup

    建两颗线段树分别存最大和最小值,模板题~ #include<cstdio> #include<algorithm> #include<cstring> using ...

  4. 三 模拟实现顺序表ArrayList

    /** * 顺序表,重点是数组动态扩容,插入 * 底层采用数组,长度可以动态变化,此处采用增长一倍 *  java.util.ArrayList每次增长50% *  int newCapacity = ...

  5. 思科Catalyst 9K

    思科的新一代产品Catalyst9K,里面涉及了Catalyst9200.Catalyst9300.Catalyst9400.Catalyst9500.Catalyst9600和Catalyst980 ...

  6. Python学习第二十五课——Mysql (多表查询)

    多表查询: 内连接查询: 首先:创建两个表一个为tableA,一个为tableB,并且插入数据(代码省略) 同时查询两个表的记录: select * from tableA,tableB; 根据tab ...

  7. Linux 命令中 more、less、head、tail 命令的用法

    more 命令 more 命令,功能类似 cat ,cat 命令是将整个文件的内容从上到下显示在屏幕上. more 命令会一页一页的显示,方便使用者逐页阅读,而最基本的指令就是按空白键(space)往 ...

  8. letter-spacing 与 word-spacing 结合使用,造成文字反转

    文字未反转时,如图: 文字反转时,如图: 以上效果只是因为发现记录下来,目前并无实用,也许未来用得着它.

  9. 关于java自学的内容及感受

    这周自学了关于java类的知识,进度有点慢,需要抓紧学习剩下的知识,放假后由于自制力差而各种玩没有认认真真的学习,下周要认真的学习之后的进度,争取开学玩全部完成! /** * 动物的类 * */pub ...

  10. js keyCode 常用键盘编码

    摘自:http://blog.csdn.net/dyllove98/article/details/8728657 keycode 8 = BackSpace BackSpace keycode 9 ...