Repository navigation
Hibernate 7: the fetch mode join of list() keeps the instances whose association is null or empty - #16898
Merged
Conversation
…in and keeps the instances whose association is null or empty list() and a paged list built 'join fetch', an inner join, so Team.list(fetch: [club: 'join']) left out the teams without a club, while a where query and a dynamic finder returned every team. It now builds 'left join fetch', as the join type LEFT does; only a join type asks for the instances to be left out. ListFetchJoinNullSpec runs the fetch mode join on an association that can be null and on a collection that can be empty for list, a paged list, a where query and a dynamic finder; the list cases fail without the change. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
jamesfredley
approved these changes
Nov 9, 2026
jamesfredley
left a comment
Contributor
There was a problem hiding this comment.
A fetch join of list() now keeps the instances whose association is null or empty.
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.
Team.list(fetch: [club: 'join'])builtjoin fetch, an inner join, so it left out the teams without a club. A where query, a dynamic finder and a criteria query with the same fetch return every team.list()and a paged list now buildleft join fetch, so the fetch modejoinfetches and never filters. A join type (JoinType.INNER) stays the way to ask for the filter.This is the Hibernate 7 half of the question jdaugherty raised on #16853; the Hibernate 5 half is on that PR (
1e475136f4). Behavior is the same on both after the two.ListFetchJoinNullSpecruns the fetch modejoinon a nullable association and on an empty collection forlist, a paged list, a where query and a dynamic finder; thelistcases fail without the change. The H7 core suite passes.