休眠:会话.负载
我正在学习冬眠。为了进行测试,我使用无效密钥调用了 session.load
。当我在调试器(JB Idea)中跨过该行后,没有任何反应 - 我预计会得到 ObjectNotFoundException。然后,我打开了 Expression Eval (alt+F8),结果是:
bookFailedLoad = {rs.hibernateTest.model.Book$$EnhancerByCGLIB$$5dd17391@2088}Method threw 'org.hibernate.ObjectNotFoundException' exception. Cannot evaluate rs.hibernateTest.model.Book$$EnhancerByCGLIB$$5dd17391.toString()
CGLIB$BOUND = true
CGLIB$CONSTRUCTED = true
CGLIB$CALLBACK_0 = {org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer@2094}
CGLIB$CALLBACK_1 = null
isbn = null
name = null
publisher = null
publishDate = null
price = 0
chapters = null
hb How did hb inform POJO that object is not valid.请有人给我推荐一篇文章,帮助我在开始调试休眠源代码之前了解幕后发生的事情。
I'm learning hibernate. To make a tests I invoked session.load
with invalid key. After I step over that line in debugger (JB Idea), nothing happen - I expected to get ObjectNotFoundException. Than, I opened Expression Eval (alt+F8) and result was:
bookFailedLoad = {rs.hibernateTest.model.Book$EnhancerByCGLIB$5dd17391@2088}Method threw 'org.hibernate.ObjectNotFoundException' exception. Cannot evaluate rs.hibernateTest.model.Book$EnhancerByCGLIB$5dd17391.toString()
CGLIB$BOUND = true
CGLIB$CONSTRUCTED = true
CGLIB$CALLBACK_0 = {org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer@2094}
CGLIB$CALLBACK_1 = null
isbn = null
name = null
publisher = null
publishDate = null
price = 0
chapters = null
How did hb inform POJO that object is not valid. Please, could someone recommend me an article to help me understand what's happening under the hood before I stock in adventure of debugging hibernate source.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须让调试器运行。如果未找到实体,
load
会引发异常。如果您查看粘贴的材料,您会在第一行看到。
就资源而言,《Hibernate in Action》书籍是我买过的最好的书籍之一。如果您要花费大量时间进行休眠,那么这是非常值得的。只需确保您获得的书籍版本与您正在使用的 hibernate 版本相关即可。
You have to let the debugger run.
load
throws an exception if the entity is not found. If you look in the material you pasted, you seeon the first line.
As far as resources are concerned, the Hibernate in Action books is one of the best books I have ever bought. Well worth it if you are going to spend a lot of time with hibernate. Just make sure the version of the book you get is relevant to the version of hibernate you are using.