-
-
Notifications
You must be signed in to change notification settings - Fork 974
ci: run all functional tests against both Hibernate 5.6 and 7.2 #15561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d7d9e7d
ci: unify functional test CI to run all tests against both Hibernate …
jamesfredley e2336d9
fix: register h7 autoconfig and remove h5-specific ehcache config
jamesfredley f587be1
ci: skip h7-incompatible general tests when running with hibernateVer…
jamesfredley fbfe66b
fix: make gorm and app1 functional tests H7-compatible
borinquenkid a458c4a
fix(h7): fix 3 H7 GORM bugs — NonUniqueResultException, aggregate ret…
borinquenkid 707c33d
fix(h7): prevent 'two representations of same collection' in addTo/sa…
borinquenkid a63dcad
fix(test): correct GormCriteriaQueriesSpec to use safe HQL overloads …
borinquenkid dc7c4a0
address PR feedback: validate hibernateVersion, rename booleans, fix …
jamesfredley b92f3d5
Merge remote-tracking branch 'origin/8.0.x-hibernate7' into ci/hibern…
jamesfredley 5a97cbe
fix(ci): substitute grails-bom with grails-hibernate7-bom for H7 func…
jamesfredley 5fa3c96
fix(ci): align hibernate to 7.2.7 and fix grails-bom publication path
jamesfredley 3f8eb79
fix(ci): swap project(':grails-bom') for h7, add micronaut-bom to for…
jamesfredley b59c548
fix(ci): attach grails-hibernate7-bom platform to test project depend…
jamesfredley 904fd76
fix(ci): pin testcontainers BOM in grails-forge-analytics-postgres
jamesfredley 5db69b2
fix(ci): correct testcontainers artifact name to org.testcontainers:p…
jamesfredley 52ba29e
fix(ci): correct testcontainers spock artifact in grails-forge-cli
jamesfredley cf6d9ce
chore(forge): move testcontainers version to gradle.properties
jamesfredley 634c9e8
Merge branch '8.0.x-hibernate7' into ci/hibernate-matrix-testing
jamesfredley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| ## H7 `gorm` Functional Test Failures — Bug Report | ||
|
|
||
| Running `grails-test-examples-gorm` with `-PhibernateVersion=7` produces 13 failures across 4 specs. | ||
| Below are the 5 distinct root causes. | ||
|
|
||
| --- | ||
|
|
||
| ### Bug 1 (Intentional) — `executeQuery` / `executeUpdate` plain String blocked | ||
|
|
||
| | | | | ||
| |---|---| | ||
| | **Tests** | `test basic HQL query`, `test HQL aggregate functions`, `test HQL group by`, `test executeUpdate for bulk operations` | | ||
| | **Spec** | `GormCriteriaQueriesSpec` | | ||
| | **Error** | `UnsupportedOperationException: executeQuery(CharSequence) only accepts a Groovy GString with interpolated parameters` | | ||
|
|
||
| **Description:** H7 intentionally rejects `executeQuery("from Book where inStock = true")` when no parameters are passed. The same tightening was already applied to `executeUpdate`. Callers must use `executeQuery('...', [:])` or a GString with interpolated params. | ||
|
|
||
| > This is by design. The test bodies need to adopt the parameterized form — not a GORM bug. | ||
|
|
||
| --- | ||
|
|
||
| ### Bug 2 — `DetachedCriteria.get()` throws `NonUniqueResultException` instead of returning first result | ||
|
|
||
| | | | | ||
| |---|---| | ||
| | **Test** | `test detached criteria as reusable query` | | ||
| | **Spec** | `GormCriteriaQueriesSpec:454` | | ||
| | **Error** | `jakarta.persistence.NonUniqueResultException: Query did not return a unique result: 2 results were returned` | | ||
|
|
||
| **Description:** H5 `DetachedCriteria.get()` returned the first matching row when multiple rows existed. H7's `AbstractSelectionQuery.getSingleResult()` is now strict and throws if the result is not unique. | ||
|
|
||
| **Expected fix:** `HibernateQueryExecutor.singleResult()` should apply `setMaxResults(1)` before calling `getSingleResult()`, or switch to `getResultList().stream().findFirst()`. | ||
|
|
||
| --- | ||
|
|
||
| ### Bug 3 — `Found two representations of same collection: gorm.Author.books` | ||
|
|
||
| | | | | ||
| |---|---| | ||
| | **Tests** | `test saving child with belongsTo saves parent reference`, `test dirty checking with associations`, `test belongsTo allows orphan removal`, `test updating multiple children`, `test addTo creates bidirectional link` | | ||
| | **Spec** | `GormCascadeOperationsSpec` | | ||
| | **Error** | `HibernateSystemException: Found two representations of same collection: gorm.Author.books` | | ||
|
|
||
| **Description:** H7 enforces stricter collection identity. After `author.addToBooks(book); author.save(flush: true)`, the session contains two references to the same `Author.books` collection, causing a `HibernateException` on flush. H5 tolerated this. | ||
|
|
||
| **Expected fix:** GORM's `addTo*` / cascade-flush path in `grails-data-hibernate7` must synchronize both sides of the bidirectional association and merge/evict stale collection snapshots before flushing. | ||
|
|
||
| --- | ||
|
|
||
| ### Bug 4 — `@Query` aggregate functions fail with type mismatch | ||
|
|
||
| | | | | ||
| |---|---| | ||
| | **Tests** | `test findAveragePrice`, `test findMaxPageCount` | | ||
| | **Spec** | `GormDataServicesSpec` | | ||
| | **Errors** | `Incorrect query result type: query produces 'java.lang.Double' but type 'java.lang.Long' was given` / `query produces 'java.lang.Integer' but type 'java.lang.Long' was given` | | ||
|
|
||
| **Description:** `HibernateHqlQuery.buildQuery()` always calls `session.createQuery(hql, ctx.targetClass())`. For aggregate HQL (`select avg(b.price) ...`, `select max(b.pageCount) ...`), the query does not return an entity, but `ctx.targetClass()` returns the entity class (e.g., `Book`). H7's `SqmQueryImpl` enforces strict result-type alignment — `avg()` produces `Double`, `max(pageCount)` produces `Integer`, neither is coercible to the bound entity type. | ||
|
|
||
| **Expected fix:** `HibernateHqlQuery.buildQuery()` must detect non-entity HQL (aggregates / projections) and call the untyped `session.createQuery(hql)` in those cases, letting GORM handle result casting downstream. | ||
|
|
||
| --- | ||
|
|
||
| ### Bug 5 — `where { pageCount > price * 10 }` fails with `CoercionException` | ||
|
|
||
| | | | | ||
| |---|---| | ||
| | **Test** | `test where query comparing two properties` | | ||
| | **Spec** | `GormWhereQueryAdvancedSpec:175` | | ||
| | **Error** | `org.hibernate.type.descriptor.java.CoercionException: Error coercing value` | | ||
|
|
||
| **Description:** A where-DSL closure comparing an `Integer` property (`pageCount`) to an arithmetic expression involving a `BigDecimal` property (`price * 10`) worked in H5. H7's SQM type system no longer allows implicit coercion between `Integer` and `BigDecimal` in a comparison predicate. | ||
|
|
||
| **Expected fix:** The GORM where-query-to-SQM translator should emit an explicit `CAST` in the SQM tree when the two operands of a comparison have different numeric types. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.