save the transient instance before flushing错误解决办法
来源:互联网 发布:java log4j pom 编辑:程序博客网 时间:2024/06/08 14:40
近日在项目中遇到以下错误,着实郁闷了一把:
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing:com.dhcc.itsm.base.model.User。
这主要是在ManyToOne时遇到的,百度之,发现原因如下:
new了一个新对象,在未保存之前将它保存进了一个新new的对象(也即不是持久态)。
解决办法是在保存或更新之前把这个对象查出来(这样就是一个持久态)。
但是后来发现同一个model里面有好几个ManyToOne,而且其标注都是:@ManyToOne(fetch=FetchType.LAZY,optional=true) 但是其中一个必须要先查,而其他的就不需要。这个问题先留这里,回头查找原因再补上。
帖子地址:http://topic.csdn.net/u/20081218/12/e74bac38-adfe-4630-aca0-700aa13a5d98.html?482827828
- save the transient instance before flushing错误解决办法
- Hibernate常见错误之save the transient instance before flushing
- save the transient instance before flushing
- save the transient instance before flushing
- save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing异常
- object references an unsaved transient instance - save the transient instance before flushing(异常总结)
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing .
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing(异常总结)
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- UBUNTU下播放RMVB文件的方法
- 小结一下最近碰到的一些应该注意的地方(PHP)
- vi编辑器命令详解
- World/Excel启动模版
- 2009年了!!
- save the transient instance before flushing错误解决办法
- 哈夫曼树的构造
- 深入浅出WPF——x:Class详解
- 向2009年说些什么
- 自定义控件(HolyrongGridView)-扩展GridView控件(2):自定义分页
- SQL Server中临时表与表变量的区别
- asp.net的TextBox回车触发事件
- "##"在宏中的作用
- 支持Firefox和IE的文本复制Javascript