2007-06-03
Hibernate映射导致的几个异常
异常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 where userID = :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)
解决方法:将“一对多”关系中的“一”方,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 where userID = :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)
发表评论
- 浏览: 15186 次
- 性别:

- 来自: 湖南长沙

- 详细资料
搜索本博客
最近加入圈子
最新评论
-
JAVA反射机制的学习
那 反射后带来的 调试困难呢
-- by tieshow -
JAVA反射机制的学习
什么时候能直接eval()就好了,不过新的语言规范加入了脚本支持。
-- by runthu -
JAVA反射机制的学习
感谢ing!对于反射的理解,最好还是自己动手code一下。像spring这些框架 ...
-- by tibetjungle -
JAVA反射机制的学习
反射机制可以简化有规律的代码,也可以增加程序的灵活性。 比如struts Act ...
-- by sunsong -
JAVA反射机制的学习
liang.zeng 写道java 的反射机制是很费资源的,程序中还是少用。 ...
-- by icewubin






评论排行榜