休眠:会话.负载

发布于 2024-12-27 02:52:51 字数 739 浏览 1 评论 0原文

我正在学习冬眠。为了进行测试,我使用无效密钥调用了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ま柒月 2025-01-03 02:52:51

您必须让调试器运行。如果未找到实体,load 会引发异常。如果您查看粘贴的材料,您会

Method threw 'org.hibernate.ObjectNotFoundException' exception. Cannot evaluate rs.hibernateTest.model.Book$EnhancerByCGLIB$5dd17391.toString()

在第一行看到。

就资源而言,《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 see

Method threw 'org.hibernate.ObjectNotFoundException' exception. Cannot evaluate rs.hibernateTest.model.Book$EnhancerByCGLIB$5dd17391.toString()

on 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文