object references an unsaved transient instance - save the transient instance be
2012-12-27 16:05
363 查看
异常1:not-null property references a null or transient value
解决方法:将“一对多”关系中的“一”方,not-null设置为false
(参考资料:http://www.thearcmind.com/confluence/pages/viewpage.action?pageId=212)
异常2:org.hibernate.TransientObjectException: object references an unsaved transient instance
解决方法:cascade="save-update,persist"
(参考资料:http://www.laliluna.de/254.html)
异常3:org.hibernate.QueryException: could not resolve property
解决方法:"from Category category where category.userID = :userID"修改为"from Category category whereuserID = :userID"或者"from Category category where category.user.id =
:userID"
(参考资料:http://www.laliluna.de/277.html)
异常4:could not initialize proxy - the owning Session was closed
解决方法:设置lazy为false
(参考资料:http://forum.springframework.org/showthread.php?t=27993)
异常2和3发生在我调用一个方法的时候,最先报错异常3,后来我修改后就报错为异常2,后通过查看一些网上的解决方案,修改了下我的配置文件,问题得以解决。
解决方法:将“一对多”关系中的“一”方,not-null设置为false
(参考资料:http://www.thearcmind.com/confluence/pages/viewpage.action?pageId=212)
异常2:org.hibernate.TransientObjectException: object references an unsaved transient instance
解决方法:cascade="save-update,persist"
(参考资料:http://www.laliluna.de/254.html)
异常3:org.hibernate.QueryException: could not resolve property
解决方法:"from Category category where category.userID = :userID"修改为"from Category category whereuserID = :userID"或者"from Category category where category.user.id =
:userID"
(参考资料:http://www.laliluna.de/277.html)
异常4:could not initialize proxy - the owning Session was closed
解决方法:设置lazy为false
(参考资料:http://forum.springframework.org/showthread.php?t=27993)
异常2和3发生在我调用一个方法的时候,最先报错异常3,后来我修改后就报错为异常2,后通过查看一些网上的解决方案,修改了下我的配置文件,问题得以解决。
相关文章推荐
- 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: com.jspxcms.core.domain.ScTeam
- 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(异常总结)
- 解决spring整合hibernate中用junit4测试,报错object references an unsaved transient instance - save the transient
- object references an unsaved transient instance - save the transient instance before flushing
- hibernate错误:object references an unsaved transient instance - save the transient instance
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing异常问题处理
- org.hibernate.TransientObjectException: object references an unsaved transient instance - save the t
- hibernate 对象状态异常:object references an unsaved transient instance - save the transient instance befor
- Nhibernate:object references an unsaved transient instance - save the transient instance before flushing.
- Hibernate 异常:object references an unsaved transient instance - save the transient instance before fl
- object references an unsaved transient instance - save the transient instance before flushing
- hibernate 对象状态异常:object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing