Skip to content

test(hibernate): pin where() creation, nested left-join subqueries, save(validate: false) and composite index order - #16847

Open
borinquenkid wants to merge 4 commits into
8.0.xfrom
test/old-issue-regressions-8.0.x
Open

borinquenkid wants to merge 4 commits into
8.0.xfrom
test/old-issue-regressions-8.0.x

Conversation

@borinquenkid

@borinquenkid borinquenkid commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Regression tests for long-open issues that already behave correctly in both the Hibernate 5 and Hibernate 7 bindings. There is no production change.

Closes #14425
Closes #14422
Related to #15276
Related to #14424

https://claude.ai/code/session_01Dmki4SQGwRSj8pRJ5KCWyX

…ueries

Creating a detached where() query that joins a collection runs no SQL, and a
left join inside a nested where() subquery keeps the rows matched only through
the primary site, in both bindings.

Closes #14425
Closes #14422

Claude-Session: https://claude.ai/code/session_01Dmki4SQGwRSj8pRJ5KCWyX
@borinquenkid
borinquenkid requested review from jamesfredley and a balanced review from Copilot November 4, 2026 00:52

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.

@borinquenkid borinquenkid changed the title test(hibernate): pin where() query creation and nested left-join subqueries test(hibernate): pin where() creation, nested left-join subqueries and save(validate: false) Nov 4, 2026
…y-run dialects

Properties naming the same index give a composite index in declaration
order on H2 (both bindings) and on PostgreSQL, MySQL and MariaDB (H7).
Document the behavior under the column mapping reference.

Related to #14424

Claude-Session: https://claude.ai/code/session_01Dmki4SQGwRSj8pRJ5KCWyX
@borinquenkid borinquenkid changed the title test(hibernate): pin where() creation, nested left-join subqueries and save(validate: false) test(hibernate): pin where() creation, nested left-join subqueries, save(validate: false) and composite index order Nov 4, 2026
@borinquenkid borinquenkid added this to the grails:8.0.1 milestone Nov 4, 2026
@borinquenkid
borinquenkid requested a review from matrei November 12, 2026 14:13

@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.

Not approving. The note says the index follows the mapping block. It follows the field order.

* `comment` (optional) - The comment for the column (used to create the table DDL)
* `defaultValue` (optional) - The database default value

Properties that name the same `index` share one composite index. The columns appear in the index in the order the properties are declared in the mapping block, so this declaration creates an index on `(token, address)`:

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.

address is declared after token, and the mapping names address first in the shared index. The index is still (token, address). Do not say the mapping block sets the order.

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 650d024. The class declaration order decides, whatever order the mapping block names the properties in, and the reference now says so, with the example reversed. The specs pin it: address named before token in the mapping, and a three-column index named chain, address, token, on Hibernate 5 and 7, and on real PostgreSQL, MySQL and MariaDB containers. All pass.

… and the specs pin it

The reference said the columns of a shared index follow the order of the
mapping block. They follow the order the properties are declared in the
class. The specs now name the properties in a different order in the
mapping block (two columns on the default and the container databases,
three on Hibernate 5 and 7), and the example in the reference shows it.

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

@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 composite index still follows the declaration order, and the note says the same.

@testlens-app

testlens-app Bot commented Nov 16, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 650d024
▶️ Tests: 93732 executed
⚪️ Checks: 147/147 completed


Learn more about TestLens at testlens.app/docs.

This branch has not been deployed

No deployments
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.

Creating (without executing) a detached Criteria (with a .where{..}) can cause select count(*) queries to run How to use join on nested association?

3 participants