You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@grails.apache.org by "borinquenkid (via GitHub)" <gi...@apache.org> on 2026/10/10 00:56:13 UTC
[PR] Hibernate 7: native domain binding through Hibernate's annotation binder (opt-in) [grails-core]
borinquenkid opened a new pull request, #16568:
URL: https://github.com/apache/grails-core/pull/16568
> **Depends on #16351** (the Java-to-Groovy migration): this branch is based on `9.0.x-java-to-groovy`, so until #16351 merges the diff shown here includes it. Once it merges, the diff shrinks to the 127 commits of this PR. Opened as a draft for that reason. The two follow-ups are stacked on it: native binding as the default, then the deletion of the classic binder.
## What
GORM for Hibernate 7 gains **native domain binding**: a `GrailsDomainGenerator` turns an already-built GORM `PersistentEntity` into a JPA/Hibernate-annotated carrier class, and Hibernate's own annotation binder binds it. Sessions, queries and proxies keep using the real domain classes (the carrier's entity name, cache regions and class-loader lookups all resolve to the real class). In this PR it is **opt-in** (`hibernate.generatedDomainClasses: true`); the next PR in the stack makes it the default, and the last one deletes the hand-built `GrailsDomainBinder`.
## Why
The classic binder re-implements Hibernate's boot model by hand (~5,800 lines) and has been the source of a steady stream of mapping defects (seven of them fixed on `8.0.x` during this work: #16520, #16522, #16523, #16524, #16531, #16532, #16533, #16539). Letting Hibernate bind the entities removes that layer; the GORM mapping DSL stays the public surface.
## Scope
* `grails-data-hibernate7/core`, package `org.grails.orm.hibernate.cfg.domainbinding.jpa`: `GrailsDomainGenerator` (ByteBuddy; every mapping option the classic binder honours, incl. composite identifiers via `@IdClass`, embedded types, all three inheritance strategies, multi-tenancy, natural ids, caches, custom and converting types, custom collection types), `GeneratedDomainClassBinder` (`AdditionalMappingContributor` plus an aligner that reproduces the classic binder's naming and DDL decisions where Hibernate's defaults differ), `GeneratedDomainClassLoader[Service]`.
* `ManyToManyOwnerValidator`: a bidirectional many-to-many with `belongsTo` on neither side now **fails at startup** (`MappingException`) instead of silently never being written; on `8.0.x` the same case logs a warning (#16532).
* Envers: a generated entity carries a JPA `@Version`, which Envers would skip; the optimistic-lock column is audited as before unless the application sets `org.hibernate.envers.do_not_audit_optimistic_locking_field` itself.
* Tests: 26 both-modes specs under `grails.gorm.tests.generated`, the whole core suite runnable through the generated classes (`-Pgrails.test.generatedDomainClasses=true`), and two differentials that compare native binding with the classic binder over every scanned test domain class (1,169 entities, 3,381 properties: **0 mismatches**; DDL: **85 known differences, 0 unknown, 0 refused**). The classic side of both differentials is **frozen** as recorded data (`src/test/resources/classic-oracle/`), so they survive the deletion of the classic binder.
* Docs: new chapter *Native Domain Binding* in the GORM for Hibernate 7 manual (what stays the same, what changes in behaviour and schema, switching an existing database, Envers, the one unsupported mapping and its workaround), configuration reference, Hibernate 7 migration checklist, and the Grails 8 โ 9 upgrade notes (`upgrading90x.adoc` ยง1).
Also in this PR, because the branch has to pass the repository's CodeNarc rules: the `grails-startup-progress` sources that arrived from upstream in Java are converted to Groovy, and intentionally empty catch parameters are named `ignored` in seven modules.
## Behaviour changes for applications (all documented in the upgrade notes)
* A many-to-many without an owning side fails at startup.
* With native binding on: a custom `UserCollectionType` on a `hasMany` of entities takes effect (the classic binder ignored it); a shared embedded collection gets a table per owner; an embedded object as a part of a composite identifier is refused with a message pointing at the documented flattening workaround; a handful of schema differences listed in the manual (for example `check (idx >= 0)` on list index columns).
## Verification
Every module of `grails-data-hibernate7` in both modes at the tip of this PR: core 4,813 tests (classic default) and 4,523 (generated), dbmigration-core 40, dbmigration 110 + 93 CLI, plugin 39 + 2, spring-boot 2, all green; both differentials as above; `codeStyle` clean; docs built.
๐ค Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Hibernate 7: native domain binding through Hibernate's annotation binder [grails-core]
Posted by "borinquenkid (via GitHub)" <gi...@apache.org>.
borinquenkid commented on PR #16568:
URL: https://github.com/apache/grails-core/pull/16568#issuecomment-6282027601
**BLOCKER before merge: this branch carries a temporary CI commit.**
This PR is stacked, and to avoid starting a full CI matrix on every push or rebase of the stack it carries one temporary commit, `CHANGEME FOR ACCEPTANCE: disable PR workflow triggers`. It changes the `pull_request:` trigger of 13 workflows to `branches: ['CHANGEME-FOR-ACCEPTANCE']`, a branch that does not exist, so pushing, rebasing or force-pushing this branch starts no jobs.
**Condition for merging this PR:** that commit must be reverted on this branch first, and CI must then run and be green. **The absence of CI checks on this PR is deliberate and does not mean the code was tested.** The full build runs on #16576 and #16572, the PRs that target 10.0.x.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Hibernate 7: native domain binding through Hibernate's annotation binder (opt-in) [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #16568:
URL: https://github.com/apache/grails-core/pull/16568#issuecomment-6169917582
## ๐จ All tests passed but jobs failed ๐จ
### Failed Jobs without Test Failures
โ [CI / Hibernate7 Functional Tests \(Java 25, indy\=false\)](https://github.com/apache/grails-core/actions/runs/38567186920/job/115862749736?pr=16568)
๐ท๏ธ Commit: 2dff415a760c38c9c09f76255d56a3d6e878b5ce
โถ๏ธ Tests: 37556 executed
๐ก Checks: 58/79 completed
### Rerun Controls
Click the checkbox to trigger a rerun:
๐ฒ **Rerun jobs**
---
_Learn more about TestLens at [testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Hibernate 7: native domain binding through Hibernate's annotation binder (opt-in) [grails-core]
Posted by "borinquenkid (via GitHub)" <gi...@apache.org>.
borinquenkid commented on PR #16568:
URL: https://github.com/apache/grails-core/pull/16568#issuecomment-6099886351
Rebuilt on #16572 (the Hibernate 7 modules converted to Groovy), as the maintainers asked to split the migration. The history of this branch was rewritten and force-pushed: please re-fetch and re-review from the new head rather than rebasing local work onto the old one. The content of the native-binding work is unchanged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Hibernate 7: native domain binding through Hibernate's annotation binder (opt-in) [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #16568:
URL: https://github.com/apache/grails-core/pull/16568#issuecomment-6195466432
## ๐จ All tests passed but jobs failed ๐จ
### Failed Jobs without Test Failures
โ [CI / Hibernate7 Functional Tests \(Java 21, indy\=false, shard 2\)](https://github.com/apache/grails-core/actions/runs/38740098677/job/116439271467?pr=16568)
๐ท๏ธ Commit: c9534d3d453a2665561fa968b98af4e14934c843
โถ๏ธ Tests: 37707 executed
๐ก Checks: 131/163 completed
### Rerun Controls
Click the checkbox to trigger a rerun:
๐ฒ **Rerun jobs**
---
_Learn more about TestLens at [testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Hibernate 7: native domain binding through Hibernate's annotation binder (opt-in) [grails-core]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #16568:
URL: https://github.com/apache/grails-core/pull/16568#issuecomment-6100470476
## [Codecov](https://app.codecov.io/gh/apache/grails-core/pull/16568?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 39.1819%. Comparing base ([`fcf18b2`](https://app.codecov.io/gh/apache/grails-core/commit/fcf18b26abb936ae47be575cd6174d889f013ebe?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`67f8fea`](https://app.codecov.io/gh/apache/grails-core/commit/67f8feacb82afbe088c7f311642409276ad13b49?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/grails-core/pull/16568?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## refactor/java-to-groovy-grails-data-hibernate7 #16568 +/- ##
=========================================================================================
- Coverage 60.9253% 39.1819% -21.7434%
+ Complexity 26894 665 -26229
=========================================================================================
Files 2259 87 -2172
Lines 113388 4987 -108401
Branches 20524 874 -19650
=========================================================================================
- Hits 69082 1954 -67128
+ Misses 35168 2713 -32455
+ Partials 9138 320 -8818
```
[see 2172 files with indirect coverage changes](https://app.codecov.io/gh/apache/grails-core/pull/16568/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Hibernate 7: native domain binding through Hibernate's annotation binder (opt-in) [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #16568:
URL: https://github.com/apache/grails-core/pull/16568#issuecomment-6100247600
## ๐จ All tests passed but jobs failed ๐จ
### Failed Jobs without Test Failures
โ [CI / Hibernate7 Functional Tests \(Java 21, indy\=false, shard 2\)](https://github.com/apache/grails-core/actions/runs/38069239529/job/114263094532?pr=16568)
๐ท๏ธ Commit: 67f8feacb82afbe088c7f311642409276ad13b49
โถ๏ธ Tests: 51982 executed
๐ก Checks: 42/78 completed
### Rerun Controls
Click the checkbox to trigger a rerun:
๐ฒ **Rerun jobs**
---
_Learn more about TestLens at [testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Hibernate 7: native domain binding through Hibernate's annotation binder (opt-in) [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #16568:
URL: https://github.com/apache/grails-core/pull/16568#issuecomment-6100892317
## ๐จ All tests passed but jobs failed ๐จ
### Failed Jobs without Test Failures
โ [CI / Hibernate7 Functional Tests \(Java 21, indy\=false, shard 2\)](https://github.com/apache/grails-core/actions/runs/38074171285/job/114277639877?pr=16568)
๐ท๏ธ Commit: f3b3ad2e1093ac42bd05d2147faada503cefcace
โถ๏ธ Tests: 53602 executed
๐ก Checks: 39/78 completed
### Rerun Controls
Click the checkbox to trigger a rerun:
๐ฒ **Rerun jobs**
---
_Learn more about TestLens at [testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Hibernate 7: native domain binding through Hibernate's annotation binder (opt-in) [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #16568:
URL: https://github.com/apache/grails-core/pull/16568#issuecomment-6111896544
## ๐จ TestLens detected 1 failed test ๐จ
### Test Summary
> [!TIP]
> Inspect all details with the [TestLens CLI](https://testlens.app/docs/features/cli): `testlens pr 16568`
#### [CI / Build Grails-Core \(Windows JDK 25 shard 2\)](https://github.com/apache/grails-core/actions/runs/38159300406/job/114528668176?pr=16568) > :grails-startup-progress:test
| Test | Runs | Flakiness |
|---|---|--:|
| StartupProgressSpec > tells a watching page why the start failed while <span>#</span>stage, then releases the port > tells a watching page why the start failed while running a hook, then releases the port | โ | 0% ๐ข |
๐ท๏ธ Commit: 80f38a21f3828a5a4047fd442e28368ffb90de76
โถ๏ธ Tests: 32164 executed
๐ก Checks: 30/78 completed
### Test Failures
<details><summary><strong>StartupProgressSpec > tells a watching page why the start failed while <span>#</span>stage, then releases the port > tells a watching page why the start failed while running a hook, then releases the port</strong> (:grails-startup-progress:test in <a href="https://github.com/apache/grails-core/actions/runs/38159300406/job/114528668176?pr=16568">CI / Build Grails-Core (Windows JDK 25 shard 2)</a>)</summary>
```
java.lang.AssertionError: No FAILED status within 30 seconds
at org.apache.grails.startup.StartupProgressSpec.awaitStatus(StartupProgressSpec.groovy:1032)
at org.apache.grails.startup.StartupProgressSpec.tells a watching page why the start failed while #stage, then releases the port(StartupProgressSpec.groovy:319)
```
</details>
### Rerun Controls
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
๐ฒ StartupProgressSpec > tells a watching page why the start failed while <span>#</span>stage, then releases the port <!-- uniqueId=[engine:spock]/[spec:org.apache.grails.startup.StartupProgressSpec]/[feature:$spock_feature_0_2] -->
Reuse successful test results:
๐ฒ โป๏ธ Only rerun the tests that failed or were muted before
Click the checkbox to trigger a rerun:
๐ฒ **Rerun jobs**
---
_Learn more about TestLens at [testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Hibernate 7: native domain binding through Hibernate's annotation binder (opt-in) [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #16568:
URL: https://github.com/apache/grails-core/pull/16568#issuecomment-6102446514
## ๐จ All tests passed but jobs failed ๐จ
### Failed Jobs without Test Failures
โ [CI / Validate Dependency Versions](https://github.com/apache/grails-core/actions/runs/38088189187/job/114319009491?pr=16568)
๐ท๏ธ Commit: ed60eea55138c49fcaa807eab9d8677e2a7ba792
โถ๏ธ Tests: 493 executed
๐ก Checks: 10/77 completed
### Rerun Controls
Click the checkbox to trigger a rerun:
๐ฒ **Rerun jobs**
---
_Learn more about TestLens at [testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Hibernate 7: native domain binding through Hibernate's annotation binder [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #16568:
URL: https://github.com/apache/grails-core/pull/16568#issuecomment-6207222849
## ๐จ All tests passed but jobs failed ๐จ
### Failed Jobs without Test Failures
โ [CI / Validate githubBranch](https://github.com/apache/grails-core/actions/runs/38844094909/job/116790559692?pr=16568)
๐ท๏ธ Commit: 823e968a094231c7fbc0d760faee0d5de8f92238
โถ๏ธ Tests: 876 executed
๐ก Checks: 100/170 completed
### Rerun Controls
Click the checkbox to trigger a rerun:
๐ฒ **Rerun jobs**
---
_Learn more about TestLens at [testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Hibernate 7: native domain binding through Hibernate's annotation binder [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #16568:
URL: https://github.com/apache/grails-core/pull/16568#issuecomment-6343799788
## ๐ No tests executed ๐
๐ท๏ธ Commit: 686239a0a8b0c8330f4a8bf0c297ebf86c052acb
โถ๏ธ Tests: 0 executed
โช๏ธ Checks: 39/39 completed
---
_Learn more about TestLens at [testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Hibernate 7: native domain binding through Hibernate's annotation binder [grails-core]
Posted by "testlens-app[bot] (via GitHub) via notifications" <no...@grails.apache.org>.
testlens-app[bot] commented on PR #16568:
URL: https://github.com/apache/grails-core/pull/16568#issuecomment-7220688068
## ๐ No tests executed ๐
๐ท๏ธ Commit: ac9e7d8236464448ec7301abae69a6ab2d128c7e
โถ๏ธ Tests: 0 executed
โช๏ธ Checks: 17/17 completed
---
_Learn more about TestLens at [testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org