Marco Belladelli (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=637b480...
) *commented* on HHH-16343 (
https://hibernate.atlassian.net/browse/HHH-16343?atlOrigin=eyJpIjoiN2Y2N2...
)
Re: Batch Fetch Size + PreLoadEventListener + Polymorphic Entity with cache enabled could
lead to IllegalStateException: Illegal pop() with non-matching
JdbcValuesSourceProcessingState (
https://hibernate.atlassian.net/browse/HHH-16343?atlOrigin=eyJpIjoiN2Y2N2...
)
Hello Jones (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) and thank you for reporting the issue.
The cause of the error you’re encountering is the same as we discussed in
https://hibernate.atlassian.net/browse/HHH-16254 (
https://hibernate.atlassian.net/browse/HHH-16254 ) : the getEntity() method in your
pre-load event is returning a proxy}}ed entity (needed for handling caching+batching
associations). This, in turn, causes the {{Hibernate.getClass() method to trigger an
initialization of the proxy, that leads to the pre-load event being called again with the
same proxy, causing an infinite recursion loop.
We’re exploring the possibility of not using a proxy in this particular case, but since
it’s always possible to obtain one in a pre-load event I’d strongly suggest handling this
case correctly. You could, for example, avoid forcing initialization by checking
Hibernate.isInitialized( event.getEntity() ) first.
(
https://hibernate.atlassian.net/browse/HHH-16343#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16343#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#100219- sha1:ac3e918 )