错误原因:

  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. 【代码审计】VAuditDemo SQL注入漏洞

    这里我们定位 sqlwaf函数 在sys/lib.php中,过滤了很多关键字,但是42 43 44行可以替换为空 比如我们可以 uni||on来绕过过滤

  2. POJ2516 Minimum Cost

    亲爱的,一个货物销售者,现在遇到了一个大问题,他需要你的帮助.在他的销售区域有 N 个店主(从 1 到 N)向他储存货物,Dearboy 有M 个供应点(从 1 到 M),每个供应点提供 K 种不同的 ...

  3. 一个支持国密SM2/SM3/SM4/SM9/ZUC/SSL的密码工具箱

    转:https://blog.csdn.net/xuq09/article/details/91815366 The GmSSL Project网址:http://gmssl.org/docs/qui ...

  4. ESLint规则整理与实际应用

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/lhb_11/article/detail ...

  5. mxgraph初体验

    最近公司让学习了mxgraph,简单总结一下 (1)mxGraph学习路径 1)API:http://jgraph.github.io/mxgraph/docs/js-api/files/index- ...

  6. kafka 分区

    1. 默认存储 /tmp/kafka-logs test-0 0:分区数

  7. C语言-调试

    1 格式化输出函数printf("%d %s",a,str):格式化控制符之间不能有“逗号”,可以用空格 1.1格式化输入函数scanf(“%d”,t)格式化控制符之间不能有空格 ...

  8. Struts+Spring+Hibernate整合笔记一

    OpenSessionInview: 1.如果当前方法没有事物环境,则调用完毕getHibernate以后.session关闭: 说明:1如果测试dao层,没有事物环境 2如果测试service层,但 ...

  9. Primecoin在windows上的部署和启动服务

     Primecoin在windows上的部署和启动服务: 一.从官方获得Primecoin的windows版安装包: 二.一路像安装客户端一样的安装: 三.安装成功后它会自动弹出客户端运行,同步数据, ...

  10. 法兰克因恶意软件感染而关闭了整个IT网络

    导读 现在,越来越多的黑客组织将目标对准大型企业和政府机构.对于黑客而言,这比感染家庭用户具有更高的潜在利益.由于勒索软件的攻击,许多市政网络已被暂时关闭,而这次法兰克福遇到了恶意软件. 法兰克福是世 ...