[hibernate-issues] [JIRA] (HHH-13909) Throw an exception if a final entity class is explicitly mapped as lazy

Gail Badner (JIRA) jira at hibernate.atlassian.net
Wed Mar 25 21:39:53 EDT 2020


Gail Badner ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Aabbef6b0-cce3-4556-9748-b721becb9c9a ) *commented* on HHH-13909 ( https://hibernate.atlassian.net/browse/HHH-13909?atlOrigin=eyJpIjoiZGRhZTA2M2U3YzI1NDEyNjhhOTQ2ZTg4M2I5YzdlNTQiLCJwIjoiaiJ9 )

Re: Throw an exception if a final entity class is explicitly mapped as lazy ( https://hibernate.atlassian.net/browse/HHH-13909?atlOrigin=eyJpIjoiZGRhZTA2M2U3YzI1NDEyNjhhOTQ2ZTg4M2I5YzdlNTQiLCJwIjoiaiJ9 )

The user guide ( https://docs.jboss.org/hibernate/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#entity-proxy ) says:

"However, if the entity class is final, Javassist will not create a proxy and you will get a POJO even when you only need a proxy reference. In this case, you could proxy an interface that this particular entity implements, as illustrated by the following example."

Example 117 in that section shows how an entity can be lazily loaded for a final class if @Proxy(proxyClass=...) is configured.

Steve Ebersole ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Aaafa2e9a-7a21-4c62-bf4a-050acb31276c ) , IIUC, there should be no exception in that case.

BTW, for the fix for HHH-13891 ( https://hibernate.atlassian.net/browse/HHH-13891 ) Open , ProxyFactoryHelper#validateProxyability throws a HibernateException which is ulitmately caught and logged as warning here ( https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java#L95-L118 ).

Do you think it makes sense to throw an exception in this case (as opposed to logging as a warning)?

Sanne Grinovero ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A99e61e65-956b-4a21-b29c-06057642e9ea ) , does this cover the case you mentioned?

( https://hibernate.atlassian.net/browse/HHH-13909#add-comment?atlOrigin=eyJpIjoiZGRhZTA2M2U3YzI1NDEyNjhhOTQ2ZTg4M2I5YzdlNTQiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13909#add-comment?atlOrigin=eyJpIjoiZGRhZTA2M2U3YzI1NDEyNjhhOTQ2ZTg4M2I5YzdlNTQiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100122- sha1:092c6a7 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200326/04ceb470/attachment.html 


More information about the hibernate-issues mailing list