Hibernate 7 - Step 1#15654
Conversation
Copy all source, test examples, BOMs, and build config from the hibernate5 namespace to hibernate7 so that the real hibernate7 PR can be reviewed as a true delta rather than a sea of new files. Modules added: - grails-hibernate7-bom (copy of grails-hibernate5-bom) - grails-data-hibernate7-core, spring-orm, grails-plugin, dbmigration, spring-boot, docs - grails-test-examples/hibernate7 (12 projects mirroring hibernate5) - gradle/hibernate7-test-config.gradle (skipHibernate7Tests flag) Build infrastructure: - publish-root-config.gradle: register hibernate7 modules for publishing - SbomPlugin.groovy: add LGPL exemptions for hibernate5 artifacts used by hibernate7 staging modules - settings.gradle: include all hibernate7 projects
|
This PR is #1 for the hibernate PR. Basically, I cloned the hibernate5 projects and then created this PR as if they were the hibernate 7 artifacts. This then allows the actual hibernate PR to be meaningful since we can better see what changed. It's not perfect, but it did cut out about 400+ files to review this way. |
|
I went ahead and renamed |
matrei
left a comment
There was a problem hiding this comment.
Thank you @jdaugherty !
There are some TCK tests that are failing because they only have
@IgnoreIf({ System.getProperty('hibernate5.gorm.suite') })
and not
@IgnoreIf({ System.getProperty('hibernate7.gorm.suite') })
|
Per discussion, I've pulled forward the addAllDomainClasses, the common base spec for mongo, & the package renames from tests -> specs |
06fe15d to
f18465a
Compare
|
Should commit 06fe15d be on this branch? |
|
@matrei i had removed it from this branch since it's to fix the datastore changes in the other branch. |
|
@matrei Actually, it looks like it got readded somehow, let me try to take it off again |
6783934 to
4c5c563
Compare
|
@matrei I believe I have removed this now. |
…R-F #15689) Continues shrinking the PR-A review surface, matching the established B/C/D/E revert pattern. Once these land on 8.0.x and 8.0.x is merged back into this branch, the reverted changes return through the merge, so the final state of stage-hibernate7 is unchanged - only the diff visible on PR-A is reduced. Reverted content: grails.gorm.tests -> grails.gorm.specs package rename (PR #15688, PR-I) Renames the test package back to grails.gorm.tests (the 8.0.x convention) across the three affected test trees: hibernate5 core (90 files), hibernate7 core (90 files), and grails-datamapping-core-test (18 files). The mongo portion was already reverted in the prior B/C/D/E revert. Hibernate 5 Micronaut BOM split (PR #15689, PR-F) Removes grails-hibernate5-micronaut-bom, its sample app (micronaut-hibernate5), and all h5-micronaut references in settings.gradle, dependencies.gradle, publish-root-config.gradle, validateMicronautBom, the doc-generation task, and the Micronaut config/upgrade guides. The generic grails-micronaut-bom is retained. NOT reverted (intentionally kept - the actual PR-A work): - The hibernate5 -> hibernate7 baseline clone - grails-hibernate7-micronaut-bom, its sample app, and all h7 references (settings/dependencies/publish/plugin/doc-gen/guides) Verified: ./gradlew help configures cleanly; compileTestGroovy passes for grails-datamapping-core-test, grails-data-hibernate5-core, and grails-data-hibernate7-core (the three renamed trees); grails-hibernate7 -micronaut-bom still publishes. Assisted-by: claude-code:claude-4.7-opus
Carve-out complete - detailed merge orderAll the changes that @matrei asked to be reviewed independently have now been carved out of this PR into focused, single-topic PRs. This comment is the authoritative merge order and a conservation check confirming nothing was lost. The full stack
Dependencies
How this PR was reducedEach carved topic was reverted on this branch (
The reverts only shrink this PR's visible diff. Once a carved PR lands on Recommended merge sequence
Hibernate 7 mirror caveat (important)The carved PRs are based on
These were removed here so this PR compiles cleanly without the carved plugins; re-applying them to the h7 clone is part of finalizing this PR after the merge-back, and keeps the h7 modules a faithful mirror of h5. Conservation checkEvery file the reverts removed from this branch is present in its standalone PR (verified): all Copilot reviewAll Copilot feedback across B-I has been addressed, replied to, and resolved (zero unresolved Copilot threads remain on any of them). |
Resolve conflicts in gradle.properties (take gradleToolingApiVersion 9.5.1 from 8.0.x; keep hibernate5Version removed per Hibernate 7 step 1) and grails-bom/micronaut/build.gradle (adopt updated comment documenting the tools.jackson exclusion added on 8.0.x). Assisted-by: claude-code:claude-4.8-opus
Commit ba235da reverted the addAllDomainClasses helper from GrailsDataTckManager and its callers, but six grails-data-mongodb specs were missed, leaving them calling a method that no longer exists. This caused initializationError failures in :grails-data-mongodb-core:test (MissingMethodException: GrailsDataMongoTckManager.addAllDomainClasses). Restore these specs to use manager.domainClasses.addAll([...]) (identical to the 8.0.x baseline and behaviorally equivalent to the removed helper), so the branch compiles without the helper as intended. The helper and its callers will return together when PR-C (#15683) lands on 8.0.x and is merged back. Assisted-by: claude-code:claude-4.8-opus
The hibernate7Functional job in gradle.yml retained unpinned action references (actions/checkout@v6, actions/setup-java@v4, gradle/actions/setup-gradle@v5.0.0) that are not on the ASF GitHub Actions allow-list. Apache's org policy rejects non-allowlisted actions, causing the entire 'CI' workflow (gradle.yml) to end in startup_failure so none of its jobs ever ran. Every other job in this file was already updated to ASF-approved, SHA-pinned versions when 8.0.x was merged in; this aligns the PR-specific hibernate7Functional job with its hibernate5Functional twin (matching pins plus the cache-provider: basic option), allowing the workflow to start. Assisted-by: claude-code:claude-4.8-opus
|
I'm trying to understand what's been done here and what's been agreed to. Originally, I was under the impression we were going to split off changes into a merge chain. My assumption then was we would revert as we went, but the opposite has been done here. I think we need to discuss more on this before merging as a result. I'm not confident we have actually reverted what we've said without a more detailed review. |
|
The micronaut-hibernate5-bom changes look to have been reverted, which is the wrong course of action. We have to split our boms so they set the right values when using a specific version of hibernate. I'm -1 on merging this until that's been restored. |
@matrei the entire point of this PR originally was to clone & split the boms. Are you suggesting we should do these as 2 PRs? If so, why did we introduce the hibernate 7 bom in this PR? |
Adds a grails-jacoco convention plugin that configures JaCoCo per subproject and registers a root jacocoAggregateReport task producing a single XML report for Codecov, handling the hibernate5/hibernate7 duplicate-class case. Applies grails-jacoco to 96 subprojects and adds the Coverage workflow that uploads to the existing codecov.yml configuration. Layers on top of PR-G (grails-code-analysis / grails-violation-aggregation), which provides the build-logic test infrastructure and plugin registration scaffold. Folds in the standalone coverage work from #15668. Extracted from the Hibernate 7 staging branch (PR #15654) per review feedback that JaCoCo should be introduced as its own focused PR for the project to review independently. Assisted-by: claude-code:claude-4.7-opus
|
Brings PR-F (#15689, the grails-hibernate5-micronaut-bom split) back onto the hibernate7 staging branch and reconciles it with the hibernate7 clone. Every conflict was resolved as the union of the incoming hibernate5 variant (from 8.0.x) and the existing hibernate7 staging variant: - settings.gradle: include both grails-hibernate5/7-micronaut-bom, both micronaut-hibernate5/7 test examples, and their project dirs - dependencies.gradle: keep the grails-hibernate7-micronaut-bom BOM block and widen the main block to also cover grails-hibernate5-micronaut-bom - publish-root-config.gradle: publish grails-hibernate7-bom and both micronaut BOMs - rat-root-config.gradle: keep the hibernate5/7 build-dir excludes - GrailsDependencyValidatorPlugin: treat grails-hibernate7-bom and grails-hibernate5-micronaut-bom as BOM projects - GrailsGradlePlugin.validateMicronautBom: accept grails-micronaut-bom plus both hibernate-specific micronaut BOMs - docs (micronaut.adoc, upgrading80x.adoc): document both the hibernate5 and hibernate7 micronaut BOMs Verified with `./gradlew help`: the full project graph configures, both micronaut BOMs publish, and both micronaut-hibernate test examples pass BOM validation. Assisted-by: claude-code:claude-opus-4-8
…hibernate7 clone The grails-hibernate7-micronaut-bom clone and its micronaut-hibernate7 sample were created before PR-F (#15689) refined the hibernate5 Micronaut BOM, so two hibernate5 fixes never reached the hibernate7 clone. Merging 8.0.x back in - which added grails-hibernate7-micronaut-bom to the dependency validator's recognized BOMs - surfaced the gap. - grails-bom/hibernate7-micronaut/build.gradle: exclude tools.jackson from the re-exported Micronaut platform, mirroring 31ec106 on the hibernate5 BOM. Without it, micronaut-platform's jackson-bom (3.1.0) shadows the version spring-boot-dependencies manages (3.1.2), and :grails-test-examples-micronaut-hibernate7:validateDependencyVersions fails. Verified passing after the fix. - micronaut-hibernate7 ApplicationStartupSpec: assert the rendered page title instead of the always-true `title || true`, mirroring 35527d8. Assisted-by: claude-code:claude-opus-4-8
…cross TCK specs Introduces a small helper method on the TCK base manager that replaces the slightly awkward `manager.domainClasses.addAll([...])` pattern with `manager.addAllDomainClasses([...])`. The implementation is one line that delegates to the existing list mutation. Mechanically replaces all 181 callers across: - grails-datamapping-tck/src/main/... (13 TCK base specs + 1 manager method definition) - grails-datamapping-core-test/src/test/... (49 core test specs) - grails-data-hibernate5/core/src/test/... (27 hibernate5 specs) - grails-data-mongodb/core/src/test/... (92 mongo specs) 182 files changed total: the helper method definition plus 181 call sites. The previous form required the caller to know that `domainClasses` was a mutable list on the manager, which leaked an implementation detail. The helper hides the field access and makes the call site read more naturally. This change was originally pulled forward into the hibernate7 staging branch (PR apache#15654 commit ed0916d) and was flagged by reviewers as unrelated to the Hibernate 7 clone. Extracting it here so it can land on 8.0.x on its own merits as a prerequisite for the Hibernate 7 work. Once merged here, the corresponding "Pull forward manager.addAllDomainClasses change" commit on the hibernate7 staging branch should be removed since it will arrive through the next merge of 8.0.x. Assisted-by: claude-code:claude-4.7-opus
Splits static code analysis out of the code-style plugin into a dedicated grails-code-analysis convention plugin (PMD + SpotBugs), and adds a root-only grails-violation-aggregation plugin that consolidates the per-module Checkstyle/CodeNarc/PMD XML reports into Markdown summaries under build/reports/violations/ via an aggregateStyleViolations task. Extracted from the Hibernate 7 staging branch (PR apache#15654) so it can be reviewed as a focused, single-topic change against 8.0.x, per review feedback that the analysis tooling should land in its own PR. Includes: - GrailsCodeAnalysisPlugin + GrailsCodeAnalysisExtension - GrailsViolationAggregationPlugin (aggregateStyleViolations) - GrailsCodeStylePlugin improvements: enable/disable properties, codenarcFix task, test-styling toggle; resource path renamed to grails-code-style, PMD config under grails-code-analysis - codeanalysis.yml workflow; codestyle.yml switched to aggregated reports - pmd/spotbugs versions; violation-fixer skill - Applies grails-code-analysis to 96 subprojects and wires forge Assisted-by: claude-code:claude-4.7-opus
Adds a grails-jacoco convention plugin that configures JaCoCo per subproject and registers a root jacocoAggregateReport task producing a single XML report for Codecov, handling the hibernate5/hibernate7 duplicate-class case. Applies grails-jacoco to 96 subprojects and adds the Coverage workflow that uploads to the existing codecov.yml configuration. Layers on top of PR-G (grails-code-analysis / grails-violation-aggregation), which provides the build-logic test infrastructure and plugin registration scaffold. Folds in the standalone coverage work from apache#15668. Extracted from the Hibernate 7 staging branch (PR apache#15654) per review feedback that JaCoCo should be introduced as its own focused PR for the project to review independently. Assisted-by: claude-code:claude-4.7-opus
Reconciles the stage branch with the carved-out PRs that have now landed on 8.0.x. The revert commits previously applied here (async/TCK-helper revert ba235da, code-analysis+jacoco revert 33412ee, h5 Micronaut BOM + tests->specs revert f0d82f6) combine with the incoming carved changes so the shared, hibernate5 and datamapping trees resolve to their finalized end state. Conflict resolution principle: shared/non-h7 files take the finalized 8.0.x content (PR-C registerDomainClasses, cleaned domain lists, codenarc style, upstream test-behavior fixes), while the stage branch's hibernate7-specific adaptations are preserved on top: - PR-C helper migration (domainClasses.addAll/addAllDomainClasses -> registerDomainClasses): take 8.0.x across the TCK, datamapping-core-test and hibernate5/core test trees. PR-D (DetachedCriteria command-chain style) and PR-E (Mongo base spec + package rename) were rejected and are absent from 8.0.x, so they do not return. - hibernate7 TCK skips preserved: re-applied System.getProperty('hibernate7. gorm.suite') to the @IgnoreIf/@PendingFeatureIf predicates on GroovyProxySpec (renamed dead hibernate6 -> hibernate7), NullValueEqualSpec, OptimisticLocking Spec, PagedResultSpec and ValidationSpec, which take-theirs had dropped. No hibernate6.gorm.suite references remain in the TCK. - Event specs (QueryEventsSpec, SessionCreationEventSpec): kept the stage branch's deliberate contextAvailable guard (run-with-guard rather than skip) while adopting 8.0.x's registerDomainClasses and cleaned domain list. - hibernate5/core structural changes kept (Hibernate5* spec renames, the grails.gorm.tests.entities subpackage); DetachedCriteriaJoinSpec takes 8.0.x's finalized body (incl. the new LEFT-JOIN subquery test) with the entities imports restored. grails-data-hibernate7/** is not on 8.0.x, so h7-only files keep ours and carry no changes in this merge. The h7 mirror pass (registerDomainClasses on the h7 test tree, plus the grails-jacoco apply-line and PMD/SpotBugs gradle.properties on the h7 modules) follows in dedicated commits. Verified: compileTestGroovy passes for grails-data-hibernate5-core, grails-datamapping-core-test, grails-datamapping-tck and grails-data-mongodb-core. Assisted-by: claude-code:claude-opus-4-8
…tree PR-C (#15683) renamed the TCK helper addAllDomainClasses to registerDomainClasses and migrated callers to varargs. It made GrailsDataTckManager.domainClasses private, so the old manager.domainClasses.addAll([...]) form no longer compiles. PR-C landed on 8.0.x but could not touch the grails-data-hibernate7 clone (it does not exist on 8.0.x), so merging 8.0.x back left the h7 core test tree broken. This mirrors PR-C's API migration across the 27 affected h7 specs: manager.domainClasses.addAll([A, B]) -> manager.registerDomainClasses(A, B). Only the registration call changes; the registered classes are unchanged. Verified: ./gradlew :grails-data-hibernate7-core:compileTestGroovy passes. Assisted-by: claude-code:claude-opus-4-8
PR-H (#15687) applies the grails-jacoco convention plugin per-module across the build (all grails-data-hibernate5/* modules included). It landed on 8.0.x but could not touch the grails-data-hibernate7 clone, so merging 8.0.x back left the h7 modules without coverage instrumentation. This adds the grails-jacoco apply-line to the six h7 modules (boot-plugin, core, dbmigration, dbmigration-core, grails-plugin, spring-orm) so each matches its hibernate5 counterpart (grails-code-style + grails-jacoco). The finalized carve-out does not apply grails-code-analysis per-module (it is registered and applied at the root via grails-violation-aggregation) and keeps no per-module PMD/SpotBugs gradle.properties, so neither is added here - the h7 modules mirror the h5 modules exactly. Verified: ./gradlew :grails-data-hibernate7-core:compileTestGroovy configures and compiles cleanly with grails-jacoco applied. Assisted-by: claude-code:claude-opus-4-8
…I now requires Completes the PR-C mirror. The merged GrailsDataTckManager makes domainClasses a private set with an empty default, so every spec must register the classes it uses via registerDomainClasses(...). The earlier mirror migrated the 27 specs using manager.domainClasses.addAll([...]), but two specs used other patterns and were missed - the full pre-PR test run surfaced them: - HibernateOptimisticLockingSpec had no setupSpec (it relied on the old manager's non-empty default set). Added setupSpec registering OptLockVersioned and OptLockNotVersioned, matching Hibernate5OptimisticLockingSpec. - HibernateValidationSpec used `manager.domainClasses += [...]` (compound-assign, now a ReadOnlyPropertyException). Switched to registerDomainClasses(...) with the full class list (TestEntity, ChildEntity included, since the default is empty), matching the hibernate5 HibernateValidationSpec. Verified: ./gradlew :grails-data-hibernate7-core:test now passes (571 tests, 0 failures, 26 skipped); all four violation reports are clean. Assisted-by: claude-code:claude-opus-4-8
Merge-back + Hibernate 7 mirror pass complete
Merge-backThe carved PRs that landed on Conflict resolution took the finalized
Hibernate 7 mirror pass (what
|
This comment has been minimized.
This comment has been minimized.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #15654 +/- ##
==================================================
- Coverage 49.0042% 48.3378% -0.6664%
+ Complexity 16759 15097 -1662
==================================================
Files 2014 1870 -144
Lines 94747 85457 -9290
Branches 16547 14900 -1647
==================================================
- Hits 46430 41308 -5122
+ Misses 41019 37815 -3204
+ Partials 7298 6334 -964 🚀 New features to boost your workflow:
|
matrei
left a comment
There was a problem hiding this comment.
I'm not particularly happy about some of the test re-formatting, but let's move on in the name of time.
| push: | ||
| branches: | ||
| - '[0-9]+.[0-9]+.x' | ||
| - '8.0.x-hibernate7.*' |
There was a problem hiding this comment.
This should not be necessary, the pull_request: below should trigger running the workflow.
There was a problem hiding this comment.
It's here because I pulled forward the changes - my assumption is we'll remove in step 2 PR. When chaining PRs together, the later PRs won't run unless in this list.
| - '[4-9]+.[0-9]+.x' | ||
| - '8.0.x-hibernate7.*' | ||
| pull_request: | ||
| # The branches below must be a subset of the branches above |
There was a problem hiding this comment.
Hmm, I wonder why we are filtering pull_request target branches?
There was a problem hiding this comment.
I'm assuming because actions have finite limits and we didn't want it running until a PR was opened against the main branch? I'm not sure though, I think we should revisit this in the weekly.
| - '[0-9]+.[0-9]+.x' | ||
| - '8.0.x-hibernate7.*' | ||
| pull_request: | ||
| branches: |
There was a problem hiding this comment.
I wonder why we are filtering pull_request target branches?
There was a problem hiding this comment.
See previous answer.
| - '[0-9]+.[0-9]+.x' | ||
| - '8.0.x-hibernate7.*' | ||
| pull_request: | ||
| branches: |
There was a problem hiding this comment.
I wonder why we are filtering pull_request target branches?
There was a problem hiding this comment.
See previous answer.
| */ | ||
| class HibernateSpecSpec extends HibernateSpec { | ||
|
|
||
|
|
There was a problem hiding this comment.
I removed the blank line.
| class QueryEventsSpec extends GrailsDataTckSpec { | ||
|
|
||
| SpecQueryEventListener listener | ||
| boolean contextAvailable = false |
There was a problem hiding this comment.
We should document why this property is necessary.
There was a problem hiding this comment.
Documentation added.
| class SessionCreationEventSpec extends GrailsDataTckSpec { | ||
|
|
||
| @Override | ||
| Listener listener | ||
| boolean contextAvailable = false |
There was a problem hiding this comment.
documentation added
| /** | ||
| * Tests for GORM Criteria Queries - both createCriteria() and DetachedCriteria. | ||
| * | ||
| * Criteria queries provide a type-safe, programmatic way to build | ||
| * complex queries without writing HQL strings. | ||
| */ | ||
| @Rollback | ||
| @Integration | ||
| @Integration(applicationClass = Application) |
There was a problem hiding this comment.
Why was (applicationClass = Application) added?
There was a problem hiding this comment.
It's not needed, so I'll remove it.
|
@matrei I agree on the styling changes, but in an effort to merge this I'd like to address this in a future PR. @jamesfredley already created a ticket to document the need to apply styling to our tests. As for the workflow changes, they can be reverted once we merge this PR in the step 2. I believe I've implemented all feedback and we seem to have multiple approvals. I'm going to merge this PR and then we can iterate on it. |
Forward-merge the 8.0.x base (hibernate7 staging module #15654 plus the pull-forward commits) into the Groovy 5 / Spring Boot 4 branch. Conflicts (4): - .github/workflows/groovy-joint-workflow.yml: kept the branch's --init-script groovy-joint-build.init.gradle hook on the pTML step. - build-logic/plugins/.../SbomPlugin.groovy: kept the branch's superset of CycloneDX license-exception mappings (antlr4-runtime, the org.jline:*@3.30.9 family, liquibase-hibernate5) alongside 8.0.x's jzlib entry. - grails-test-suite-uber/.../DomainClassWithInnerClassUsingStaticCompilationSpec.groovy: took 8.0.x's removal of the namedQueries closure (deprecated feature removed on 8.0.x; the corresponding field and test method were already dropped by the auto-merge, so the closure was orphaned). - grails-data-hibernate7/core/.../HibernateEventListeners.java: accepted 8.0.x's hibernate7 staging file (false rename/delete pairing with a deleted logback.groovy). Assisted-by: claude-code:claude-4.8-opus
creating this request by cloning the existing hibernate five modules so that we can easily review the hibernate seven changes between hibernate five and seven
Copy all source, test examples, BOMs, and build config from the
hibernate5 namespace to hibernate7 so that the real hibernate7 PR
can be reviewed as a true delta rather than a sea of new files.
Modules added:
Build infrastructure: