Repository navigation
Fetch singular associations right away in PostponedFetchRoot - #68
Merged
Merged
Conversation
PostponedFetchRoot postponed every fetch. Since 82cf971 it is also used on Hibernate when the page has a limit. A fetched @manytoone then dropped out of the select list, and ordering on it under DISTINCT, which optional criteria cause, failed on H2 and PostgreSQL with "Order by expression must be in the result list". PostponedFetchRoot now fetches a singular association with a left fetch join in the paged query, via the new SingularFetch, as it does not multiply rows. Everything else is postponed as before. A postponed fetch nested in a singular association also postpones all its ancestor paths, so that the secondary query can build the fetch joins down to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PostponedFetchRootpostponed every fetch. Since 82cf971 it is also used on Hibernate when the page has a limit. A fetched@ManyToOnethen dropped out of the select list. Ordering on it underDISTINCT, which optional criteria cause, failed on H2 and PostgreSQL with "Order by expression must be in the result list".PostponedFetchRootnow fetches a singular association with a left fetch join in the paged query, via the newSingularFetch, because it does not multiply rows. Everything else is postponed as before, embeddables included. A postponed fetch nested in a singular association also postpones all its ancestor paths, so that the secondary query can build the fetch joins down to it. Those ancestors are then fetched once more by the secondary query.testPhonePageWithOwnersSortedByOwnerEmailAndOptionalCriteriareproduces the failure. New ITtestPhonePageWithOwnerPhonesAndPaginationcovers a plural fetch nested in a singular one.PostponedFetchTest#rootFetchByAnyOverloadIsPostponedasserted the old contract, so it is replaced by tests for the new one.#61 has the same origin but is a separate bug:
@OneToManyordering is still skipped underPostponedFetchRoot.🤖 Generated with Claude Opus 5.5