Repository navigation
docs: upgrade note for the Hibernate 7 list() fetch mode join - #16940
Conversation
jamesfredley
left a comment
There was a problem hiding this comment.
The note matches the list query: a missing association does not drop the row.
|
|
||
| * 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')`. |
There was a problem hiding this comment.
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 PlayersCould the bullet show that, with the jakarta.persistence.criteria import, since Hibernate has a JoinType of its own too?
There was a problem hiding this comment.
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')`. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
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? |
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.
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.
Adds the upgrade note for #16898, which changed the rows the Hibernate 7
list()returns with the fetch modejoin(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