Conversation
…classes The Spotless Apply commit reformatted these Java files using Google Java Format (2-space indentation), which violated the project's Checkstyle rules that require 4-space indentation. Restore the 5 affected files to 4-space indentation and fix the off-by-one space in HibernatePersistenceContextInterceptor.java line 107. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- gradle/code-style-config.gradle:
- Remove Checkstyle plugin/config; add Spotless (palantirJavaFormat,
4-space indent) with import ordering matching the former Checkstyle
ImportOrderCheck groups (java|javax → groovy → jakarta → other →
spring → grails → static last), removeUnusedImports,
trimTrailingWhitespace, endWithNewline
- Add PMD plugin globally alongside CodeNarc; backed by a new
etc/config/pmd/pmd.xml ruleset (bestpractices, errorprone, security)
- codeStyle task now runs: Spotless check + CodeNarc + PMD
- gradle.properties:
- Replace checkstyleVersion with pmdVersion=6.55.0
- etc/config/pmd/pmd.xml:
- New PMD ruleset (category/java/bestpractices, errorprone, security)
- grails-data-hibernate7/core/build.gradle:
- Remove local pmd and spotless plugin declarations/config (now
handled globally via code-style-config.gradle)
- Apply code-style-config.gradle; keep SpotBugs local config
Note: run ./gradlew spotlessApply to reformat existing Java sources to
palantirJavaFormat before next code style check.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1. Enables the DSL: Adds createAlias to HibernateCriteriaBuilder and the CriteriaMethodInvoker infrastructure.
2. Solves the "Basic Collection" Gap: Introduces the HibernateAlias metadata class to handle aliasing for basic collections (like Set<String>), which GORM traditionally handled differently than
standard associations.
3. Bypasses H7 Restrictions: Updates JpaFromProvider and PredicateGenerator to use these aliases to resolve the "multivalued path" errors that Hibernate 7 throws when seeing collections in IN
clauses.
4. Ensures Validation: Fixes the ConfigurationException so the query engine recognizes these aliases as valid paths.
Partial ByteBuddy implementation
Partial ByteBuddy implementation 2
Proxy is working
Centralized Laziness Intelligence * Consolidated Logic: Migrated fragmented laziness rules from multiple binders into the core GrailsHibernatePersistentEntity and HibernatePersistentProperty models. * Idempotent Binding: Ensured that laziness decisions are consistent throughout the entire binding lifecycle by establishing the entity model as the single source of truth. * Refined Property Capabilities: Overrode isLazyAble() to correctly identify all Hibernate 7 association types, including unidirectional collections, as candidates for lazy loading. Encapsulated Entity Model Logic * Fluent API: Introduced a fluent isLazy() method in HibernatePersistentProperty that delegates to its owner entity, providing a clean and integrated way to query property state. * Type-Safe Mapping Access: Added specialized accessors like getHibernateMappedForm() to ensure binders can retrieve Hibernate-specific configuration (Mapping) without unsafe casting. * Subclass Synchronization: Implemented necessary overrides in property subclasses (HibernateOneToManyProperty, etc.) to ensure centralized logic is preserved across the inheritance hierarchy. Refactored Binder Integration * Unified Binder Logic: Refactored PropertyBinder, CollectionForPropertyConfigBinder, and all association binders to utilize the centralized isLazy() and mapping access methods. * Collection Fixes: Corrected a bug in the collection binder where GORM's lazy configuration was being incorrectly mapped to Hibernate's extraLazy feature. * Restored Interface Integrity: Fully synchronized the GrailsHibernatePersistentEntity interface to support legacy GORM method signatures while integrating new Hibernate 7 metadata requirements.
Key Enhancements & Fixes:
* Fixed Many-to-Many Persistence: Removed an erroneous setInverse call in ManyToManyElementBinder that was hardcoding bidirectional associations as inverse. This restored the correct GORM ownership
rules and fixed issues where join table entries were not being created.
* Resolved SemanticException in Subqueries: Refactored PredicateGenerator to accurately infer the Java return type for IN subqueries. It now dynamically detects projections—including aliased and nested
properties (e.g., e1.id)—to ensure the subquery result matches the type expected by the Hibernate 7 SQM engine.
* Fixed Subquery Alias Isolation: Improved PredicateGenerator to use a specialized JpaFromProvider constructor for subqueries. This correctly isolates and registers subquery-specific aliases, preventing
PathElementException when using DetachedCriteria within a main query.
…rect, still support legacy value hardcoded
* Query Engine Precision:
* Replaced inefficient IN subqueries with true SQL JOINs for association criteria.
* Enabled full support for user-specified JoinType (INNER, LEFT, etc.) across all criteria APIs.
* Resolved ClassCastException and IllegalArgumentException issues when navigating deeply nested association paths or querying into @Embedded components.
* Fixed correlated subquery support (exists) to correctly handle its own independent join providers.
* Fix HQL Queries
* Solidify PagedResultList
* Solidify PagedResultList and PMD
This comment has been minimized.
This comment has been minimized.
* RAT
* CodeStyle/PMD
This comment has been minimized.
This comment has been minimized.
* CodeNarc
* remove invalid test
This comment has been minimized.
This comment has been minimized.
🚨 TestLens detected 380 failed tests 🚨Here is what you can do:
Test Summary
🏷️ Commit: bacd5fa Test Failures (first 5 of 380)DataServiceDatasourceInheritanceSpec > count routes to secondary datasource via inherited connection (:grails-test-examples-hibernate7-grails-data-service-multi-datasource:integrationTest in CI / Functional Tests (Java 21, indy=false))
DataServiceDatasourceInheritanceSpec > delete routes to secondary datasource via inherited connection (:grails-test-examples-hibernate7-grails-data-service-multi-datasource:integrationTest in CI / Functional Tests (Java 21, indy=false))DataServiceDatasourceInheritanceSpec > findAllByName routes to secondary datasource via inherited connection (:grails-test-examples-hibernate7-grails-data-service-multi-datasource:integrationTest in CI / Functional Tests (Java 21, indy=false))DataServiceDatasourceInheritanceSpec > findByName routes to secondary datasource via inherited connection (:grails-test-examples-hibernate7-grails-data-service-multi-datasource:integrationTest in CI / Functional Tests (Java 21, indy=false))DataServiceDatasourceInheritanceSpec > get by ID routes to secondary datasource via inherited connection (:grails-test-examples-hibernate7-grails-data-service-multi-datasource:integrationTest in CI / Functional Tests (Java 21, indy=false))Muted TestsNote Checks are currently running using the configuration below. Select tests to mute in this pull request: 🔲 AsyncReadMethodsSpec > Test multiples GORM promises using dynamic finder method 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. |
I accidentally pushed to 8.0.x-hibernate7 instead of 8.0.x-hibernate7-bom. This caused #15510 to close as a result.
From that PR's todos:
Current Progress:
TODO:
I am opening this PR to track the status of Hibernate 7 merge to 8.x.