Aleksandr B. (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiOTVlMmViN2I4...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16043?atlOrigin=eyJpIjoiOTVlMm...
) HHH-16043 (
https://hibernate.atlassian.net/browse/HHH-16043?atlOrigin=eyJpIjoiOTVlMm...
) Hibernate 6.x brakes collection batch fetching (
https://hibernate.atlassian.net/browse/HHH-16043?atlOrigin=eyJpIjoiOTVlMm...
)
Issue Type: Bug Affects Versions: 6.2.0.CR1, 6.1.6 Assignee: Unassigned Components:
hibernate-core Created: 14/Jan/2023 08:23 AM Environment: hibernate-core:6.1.6.FInal, All
jdk (11, 17), MacOS, All platforms (verified on h2, oracle) Priority: Major Reporter:
Aleksandr B. (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Hibernate brakes correct collection batch fetching in 2 ways.
I set global hibernate.default_batch_fetch_size=16.
* When I try to initialize a lazy collection and there are other 5 similar uninitialized
collections I expect that hibernate will initialize all of them in one single query,
something like
select ... from ... where id in(?,?,?,?,?,?)
But hibernate 6.x generates a lot of similar queries. All theese queries contain
overlapping ids.
* When I try to initialize a single lazy collection I expect that hibernate will
initialize it with single bind parameter.
But hibernate 6.x initialize it with in cluase with 16 binding parameters.
I researched first issue and I think that the cause is incorrect empty persistence
collection handling.
If some parent entity doesn’t contain children entities BatchFetchQueue is incorrectly
cleared.
I think after CollectionLoaderBatchKey::batchLoad hibernate should delete all batchIds
from BatchFetchQueue but in reality it deletes only one of them.
This leads to fact that hibernate try to load same collections againg and againg.
(
https://hibernate.atlassian.net/browse/HHH-16043#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16043#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 )