Skip to content

docs: upgrade note for the Hibernate 7 list() fetch mode join - #16940

Merged
jdaugherty merged 4 commits into
8.0.xfrom
docs/h7-list-fetch-join-upgrade-note-8.0.x
Dec 3, 2026
Merged

jdaugherty merged 4 commits into
8.0.xfrom
docs/h7-list-fetch-join-upgrade-note-8.0.x

Conversation

@borinquenkid

Copy link
Copy Markdown
Member

Adds the upgrade note for #16898, which changed the rows the Hibernate 7 list() returns with the fetch mode join (every team is returned, including those without the association). Refs #16939; it does not close it, because the Hibernate 5 half (7.0.x) is still open.

@matrei raised on #16898 that 8.0.0 shipped the old result and the change had no note. The decision is to keep the change and document it, instead of reverting. Documentation only.

https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL

Copilot AI balanced review requested due to automatic review settings November 12, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

jamesfredley
jamesfredley previously approved these changes Nov 12, 2026

@jamesfredley jamesfredley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The note matches the list query: a missing association does not drop the row.

codeconsole
codeconsole previously approved these changes Nov 12, 2026

@codeconsole codeconsole left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The note matches what HqlListQueryBuilder now renders (left join fetch for join/eager), and the 95 is right while #16935 and #16836 both hold 94. Two non-blocking suggestions on the workaround bullet, which I checked on H2 against the Club/Team/Player fixtures of ListFetchJoinNullSpec.


* In 8.0.0, `Team.list(fetch: [club: 'join'])` built an inner `join fetch`, so the teams without a club were left out, and `Team.list(fetch: [players: 'join'])` left out the teams without players.
* Now both return every team, as a where query, a dynamic finder and a criteria query with the same fetch always did. The association of a team without one is `null`, or an empty collection.
* To get the earlier rows back, ask for the filter with an inner join type (`JoinType.INNER`), or query with a where query or a criteria query that restricts the association, for example `isNotNull('club')`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list() takes no join type, so a reader has nowhere to put JoinType.INNER from this sentence. It goes on a criteria query's join, which I checked returns the 8.0.0 rows:

import jakarta.persistence.criteria.JoinType

Team.createCriteria().list { join('club', JoinType.INNER) }    // Playerless Team, Team With Players
Team.createCriteria().list { join('players', JoinType.INNER) } // Team With Players

Could the bullet show that, with the jakarta.persistence.criteria import, since Hibernate has a JoinType of its own too?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #16961 (stacked on this branch, so this PR stays as it is): the bullet now says the inner join goes on the join of a criteria query, shows both queries, and names the jakarta.persistence.criteria import.


* In 8.0.0, `Team.list(fetch: [club: 'join'])` built an inner `join fetch`, so the teams without a club were left out, and `Team.list(fetch: [players: 'join'])` left out the teams without players.
* Now both return every team, as a where query, a dynamic finder and a criteria query with the same fetch always did. The association of a team without one is `null`, or an empty collection.
* To get the earlier rows back, ask for the filter with an inner join type (`JoinType.INNER`), or query with a where query or a criteria query that restricts the association, for example `isNotNull('club')`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isNotNull('club') covers the first case of the note but not the second: for players the restriction is isNotEmpty('players') (checked: it returns only Team With Players). Worth naming both, since the note gives both examples.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also in #16961: the bullet now names isNotEmpty('players') next to isNotNull('club').

…ia query, and name both restrictions (#16961)

Addresses the review of #16940: list() takes no join type, so JoinType.INNER goes on the join of a criteria query,
with the jakarta.persistence.criteria import; the restriction for players is isNotEmpty, as isNotNull covers club.

Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
@borinquenkid

Copy link
Copy Markdown
Member Author

Merged 8.0.x into this branch to clear the conflict. Both upgrade sections are kept, and the heading has no number now, as the other notes of the 8.0.1 section. The branch already holds #16961 (the inner join on the criteria query, and both restrictions named), so the thread on line 4982 is answered. Approvals from before the push are gone: James and Scott, could you look again?

@jdaugherty
jdaugherty merged commit ed188b5 into 8.0.x Dec 3, 2026
44 checks passed
@jdaugherty
jdaugherty deleted the docs/h7-list-fetch-join-upgrade-note-8.0.x branch December 3, 2026 15:41
@matrei matrei mentioned this pull request Dec 3, 2026
14 of 16 tasks
This was referenced Dec 4, 2026
jdaugherty added a commit that referenced this pull request Dec 5, 2026
Brings 9.0.x's #16908, #17317 and #17319, 8.0.x's #16720, #16559, #16940, #16976, #17312,
#17315 and #17318, and the merge of 7.2.x that came up through 8.0.x and 8.1.x
(7b371cb): #17058, #17193, #17046, #17078, #16986, #17292 and #17307, the layout, view
and template name checks, and the SiteMesh 3 layout name check.

No conflicts. As #17316 and #17317 did on their branches, the GSP Spring Boot script
example grabs the version this branch publishes, 9.1.0-SNAPSHOT.
jdaugherty added a commit that referenced this pull request Dec 5, 2026
Brings the merge of 9.0.x into 9.1.x (950aa9a): 9.0.x's #16908, #17317 and #17319,
8.0.x's #16720, #16559, #16940, #16976, #17312, #17315 and #17318, and 7.0.x's #17058,
#17193, #17046, #17078, #16986, #17292 and #17307, the layout, view and template name
checks, and the SiteMesh 3 layout name check.

No conflicts. As #17316 and #17317 did on their branches, the GSP Spring Boot script
example grabs the version this branch publishes, 10.0.0-SNAPSHOT.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants