Ivan Stanic (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5eadd5a...
) *commented* on HHH-304 (
https://hibernate.atlassian.net/browse/HHH-304?atlOrigin=eyJpIjoiOTg3NTU5...
)
Re: Subselect fetching with setMaxResults() (
https://hibernate.atlassian.net/browse/HHH-304?atlOrigin=eyJpIjoiOTg3NTU5...
)
Hi Christian Beikov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) ,
Sorry for late reply.
I think that adding some config that would control this behavior is way to go, and by
default it would not be applicable. I see that there are following options:
* Introduce 2 options, one to apply the limit to subquery, another to check for
correspondence of data. With this setup one who uses SNAPSHOT or SERIALIZABLE transaction
isolation levels can go with true and false, and the one who uses READ_COMMITED can go
with true and true options.
SUBQUERY_APPLY_LIMIT SUBQUERY_CHECK_CORRESPONDENCE SNAPSHOT or SERIALIZABLE true false
READ_COMMITED true true
With this parametrization we would avoid additional correspondence check if not
necessary.
If SUBQUERY_CHECK_CORRESPONDENCE is true, and some data is found that does not belong here
than another query can be executed with no limit option.
2. Introduce only SUBQUERY_APPLY_LIMIT and always check for correspondence. This would
introduce some not needed check in case of transactions levels SNAPSHOT or SERIALIZABLE
3. Introduce only SUBQUERY_APPLY_LIMIT and never check for correspondence by default. This
should be followed with some documentation that this should be used only if transaction
isolation levels are SNAPSHOT or SERIALIZABLE
4. Do not use any options, always apply limit and always check for correspondence.
I am in favor of the option 1 as the one with the most flexibility but other options are
fine as well.
Regards,
Ivan
(
https://hibernate.atlassian.net/browse/HHH-304#add-comment?atlOrigin=eyJp...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-304#add-comment?atlOrigin=eyJp...
)
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 )