Emond Papegaaij (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-16025 (
https://hibernate.atlassian.net/browse/HHH-16025?atlOrigin=eyJpIjoiMjAyYj...
)
Re: Using BatchEntitySelectFetchInitializer with caching leads to caching wrong values (
https://hibernate.atlassian.net/browse/HHH-16025?atlOrigin=eyJpIjoiMjAyYj...
)
Not only the cache gets corrupted, but the @PostLoad lifecycle event gets triggered before
the entity is completely assembled. During the @PostLoad , the references are all still
null.
I've constructed a testcase that demonstrates both issues. The @PostLoad contains a
System.out.println for the reference, which you can see is null. It finally fails on the
entity being loaded from the 2nd level cache with a null reference. For this test, I had
to select CacheConcurrencyStrategy.NONSTRICT_READ_WRITE. I’m not exactly sure why, but
with the default strategy the cache was not updated with the results of the query. I ran
into this issue in our application on WildFly 27 (with a patched version of hibernate
6.1.6) and an Infinispan cache, and we do not specify a CacheConcurrencyStrategy.
(
https://hibernate.atlassian.net/browse/HHH-16025#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16025#add-comment?atlOrigin=ey...
)
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....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100214- sha1:b03f6a4 )