[hibernate-dev] multiLoad support
Steve Ebersole
steve at hibernate.org
Mon Jul 25 13:27:25 EDT 2016
I wanted to start a consolidated discussion about multi-load support. This
relates to a few Jiras, questioning a few different aspects of its current
behavior:
https://hibernate.atlassian.net/browse/HHH-10984
https://hibernate.atlassian.net/browse/HHH-10617
Basically this comes down to the following questions/requests...
## Handling locally deleted entities
First (from HHH-10984) is the idea that locally deleted entities are
currently returned from multi-load calls. The background here is that
multi-load support was designed based on IdentifierLoadAccess#getReference
(Session#load). So its outcome follows what is done for #getReference in
terms of behavior and results. Now one of the behaviors of #getReference
that differs from IdentifierLoadAccess#load (Session#get) is how locally
deleted entities are treated: #getReference will return them, whereas #load
will not.
So as I see it we have 3 options:
1. Continue to expose just the one form on MultiIdentifierLoadAccess and
either have this filter out the locally deleted objects, or add a new
option to specify whether locally deleted objects ought to be returned in
the results.
2. Expose 2 distinct forms on MultiIdentifierLoadAccess:
1. Plural form of #getReference (current behavior, more or less)
2. Plural form of #load
3. Expose 3 distinct forms on MultiIdentifierLoadAccess:
1. Plural form of #getReference
2. Plural form of #load
3. "Hybrid" form
## Ordering of results
Much of the discussion on HHH-10984 revolves around the (poorly based, imo)
assumption that because a List/array of ids is passed in and because a List
is returned that we ought to return the results in the order indicated by
the incoming List/array of ids.
While I do not agree with the assumption there, I can see that that
behavior might sometimes be beneficial. Is this something we want to
support? There is certainly a performance overhead, and so I think we
definitely do not want to support it by default. But do we want to expose
an option to allow users to request this?
More information about the hibernate-dev
mailing list