[hibernate-issues] [JIRA] (HHH-14004) Enhanced Proxies are never loaded from 2LC

Sanne Grinovero (JIRA) jira at hibernate.atlassian.net
Wed May 6 11:26:26 EDT 2020


Sanne Grinovero ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A99e61e65-956b-4a21-b29c-06057642e9ea ) *created* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiODA0YTlmODZiOTgwNDIxOGI3MTA2MDVmOTUzYTMwYjMiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-14004?atlOrigin=eyJpIjoiODA0YTlmODZiOTgwNDIxOGI3MTA2MDVmOTUzYTMwYjMiLCJwIjoiaiJ9 ) HHH-14004 ( https://hibernate.atlassian.net/browse/HHH-14004?atlOrigin=eyJpIjoiODA0YTlmODZiOTgwNDIxOGI3MTA2MDVmOTUzYTMwYjMiLCJwIjoiaiJ9 ) Enhanced Proxies are never loaded from 2LC ( https://hibernate.atlassian.net/browse/HHH-14004?atlOrigin=eyJpIjoiODA0YTlmODZiOTgwNDIxOGI3MTA2MDVmOTUzYTMwYjMiLCJwIjoiaiJ9 )

Issue Type: Bug Affects Versions: 5.4.15, 5.4.14 Assignee: Sanne Grinovero ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A99e61e65-956b-4a21-b29c-06057642e9ea ) Components: hibernate-core Created: 06/May/2020 08:26 AM Fix Versions: 5.5.0.Beta1, 5.4.16 Priority: Major Reporter: Sanne Grinovero ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A99e61e65-956b-4a21-b29c-06057642e9ea )

It seems using Enhanced Proxies will ignore the 2LC.
In particular I can reproduce that when initializing fields from an association which is handled by an enhanced proxy, the proxy gets initialized from the DB even if the matching data was available in the shared cache.

There's multiple ways in which we could improve this;

* we could check the 2LC before actually creating the uninitialized proxy instance
* we could check the 2LC when an uninitialized proxy needs to be loaded
* we could do both

In terms of performance, I don't think we can guess what is the optimal approach; this will likely be circumstantial. Clearly checking the 2LC twice would lead to least DB operations, but checking the cache is not entirely free either and the chances for the object to appear in the 2LC in the likely very short time before the two checks would - IMO - make this not worth it.

So I think we should fix this via the first strategy; this might be slightly too soon but it guarantees to avoid the setup costs of the uninitialized proxy.

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

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#100126- sha1:99a90f9 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200506/98728e88/attachment.html 


More information about the hibernate-issues mailing list