Skip to content

Test a sort through the root alias by a bag whose fetch is deferred - #17307

Merged
jdaugherty merged 1 commit into
7.0.xfrom
test/hibernate5-root-alias-sort-deferred-fetch
Dec 3, 2026
Merged

jdaugherty merged 1 commit into
7.0.xfrom
test/hibernate5-root-alias-sort-deferred-fetch

Conversation

@matrei

@matrei matrei commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Description

Test-only follow-up to 7fa74e0, which fixed the compile error that #17072 and #17073 made together on 7.0.x.

#17073 strips this, the alias of the queried class, from the sort of a static list with a recursive call of addOrderPossiblyNested. #17072 gave that method the join types of the fetches that a sort defers. 7fa74e0 passes them on in that call, so sort: 'this.regulars.name' joins a bag whose fetch was deferred with the left join of that fetch, as sort: 'regulars.name' does. No test covered that. The call also compiles with an empty map in their place, and AssociationSortSpec and AssociationSortLeftJoinSpec still pass.

A new AssociationSortSpec feature runs #17072's test of those join types, 'a sort by a bag whose fetch is deferred keeps the left join of the fetch', with this.trophies.title and this.regulars.name.

Verification

On this branch:

  • :grails-data-hibernate5-core:test passes: 3,267 tests, no failures, 168 skipped.
  • :grails-data-hibernate5-core:codeStyle finds no Checkstyle or CodeNarc violations.
  • With an empty map in place of deferredFetchJoinTypes in that call, the three rows of the new feature fail in AssociationSortSpec, which runs without leftJoinAssociationSort: the squad without regulars is lost. AssociationSortLeftJoinSpec joins left either way. Every other feature of the two specs passes with the empty map.

7fa74e0 passes the join types of the deferred fetches on in the call
that strips this, the alias of the queried class, from the sort of a
static list. A new AssociationSortSpec feature runs the test of those join
types with this.trophies.title and this.regulars.name: the squad without
regulars is kept, as it is without the alias. With an empty map in place of
the join types, the feature fails without the leftJoinAssociationSort
setting.
@matrei matrei added the run ci label Dec 3, 2026
@matrei
matrei marked this pull request as ready for review December 3, 2026 13:02
@testlens-app

testlens-app Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🚨 All tests passed but jobs failed 🚨

Failed Jobs without Test Failures

❌ CI / Build Grails-Core (windows-latest, 25, true)

🏷️ Commit: cd5c2e6
▶️ Tests: 41090 executed
🟡 Checks: 83/85 completed

Rerun Controls

Click the checkbox to trigger a rerun:

🔲 Rerun jobs


Learn more about TestLens at testlens.app/docs.

@jdaugherty

Copy link
Copy Markdown
Contributor

Because this is just a test, i'm going to go ahead and merge this.

@jdaugherty
jdaugherty merged commit 65e12bb into 7.0.x Dec 3, 2026
85 of 86 checks passed
@jdaugherty
jdaugherty deleted the test/hibernate5-root-alias-sort-deferred-fetch branch December 3, 2026 15:20
jdaugherty added a commit that referenced this pull request Dec 5, 2026
Brings #17058, #17193, #17046, #17078, #16986, #17292 and #17307 from 7.0.x, the layout,
view and template name checks of 7.0.x, and the SiteMesh 3 layout name check of 7.2.x.

Asked of this merge by those pull requests:

- #17292: grails-testing-support-mongodb/build.gradle keeps the 8.0.x dependencies and adds
  the three test dependencies after them.
- #16986: QueryLockSpec for Hibernate 7 has the finder cases of the Hibernate 5 spec, without
  the lock argument of a criteria list, which Hibernate 7 does not apply (#17077).
  Query.lock(false) sets LockModeType.NONE, as on 7.0.x; it set null here.
- The layout, view and template name notes, and the SiteMesh 3 one, are also in the
  Grails 8.0.1 section of upgrading80x.adoc, with the other notes of this merge. The
  note on enums under grails-app/domain is in the 8.0.1 part of the upgrade skill.

Adapted to 8.0.x: the Hibernate 5 specs import the entities of grails.gorm.tests.entities
and register their domain classes with registerDomainClasses; DynamicFinder.buildMatchSpec
keeps the 8.0.x structure and gains the check for a trailing operator; the test
dependencies of grails-gsp-core and grails-views-core gain byte-buddy and objenesis.
jdaugherty added a commit that referenced this pull request Dec 5, 2026
Brings the merge of 7.2.x into 8.0.x (847e06d): #17058, #17193, #17046, #17078, #16986,
#17292 and #17307, the layout, view and template name checks, and the SiteMesh 3 layout
name check.

One conflict, in the grails-upgrade skill: the section on enums under grails-app/domain
ends the Grails 8.0 part, where 8.1.x begins its Grails 8.1.0 part. Both are kept, the 8.0
section first, as in #17326.
jdaugherty added a commit that referenced this pull request Dec 5, 2026
Brings the merge of 8.0.x into 8.1.x (b41309f): #17058, #17193, #17046, #17078, #16986,
#17292 and #17307, the layout, view and template name checks, and the SiteMesh 3 layout
name check.

Two conflicts. The grails-upgrade skill is kept as 9.0.x has it, as in #17327: it covers
the upgrade from Grails 8 to 9 only, and the section this merge brings belongs to the
Grails 8 skill. AstUtilsSpec keeps the features of both sides.
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.
jdaugherty pushed a commit to jdaugherty/grails-core that referenced this pull request Dec 5, 2026
Carries apache#17046 (multi-tenant load and proxy query only in discriminator
mode), apache#17193 (enums, interfaces, traits and nested classes under
grails-app/domain are not domain classes), apache#16986 (Query.lock(false)
no longer locks), apache#17078 (query arguments reach where queries and
dynamic finders with Hibernate 5), apache#17058 (a dynamic finder refuses
text after its operator), apache#17292 and apache#17307 (tests), and the commits
that keep layout, view and template names within the directory they
are looked up in, up to 20f2ee77a7.

- upgrading60x.adoc keeps the 7.1.x side; the changes to the 7.0.18
  notes are applied to upgrading70x.adoc, where 7.1.x keeps them.
- The grails-upgrade skill gets the 7.0.x section on enums and other
  types under grails-app/domain at the end of its 7.0 part, before
  the 7.1.0 part.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants