This is an automated email from the ASF dual-hosted git repository. borinquenkid pushed a commit to branch 8.0.x-hibernate7 in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 919dbc51a7229e49d497105c29812693242d715b Author: Walter Duque de Estrada <[email protected]> AuthorDate: Thu Jun 18 19:57:14 2026 -0500 Fix review comments: Query.java TODO, FirstAndLastMethodSpec failOnError, H7 plugin build comment - Query.java: remove stale 'will be resolved in Grails 8' from warn message and TODO; Hibernate 7 already resolves this via HibernateQuery.countResults() - FirstAndLastMethodSpec: remove redundant failOnError from save() calls; assert already catches null return; keep flush:true on final save - grails-data-hibernate7/grails-plugin/build.gradle: remove stale TODO comment Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --- grails-data-hibernate7/grails-plugin/build.gradle | 1 - .../grails/data/testing/tck/tests/FirstAndLastMethodSpec.groovy | 8 ++++---- .../src/main/groovy/org/grails/datastore/mapping/query/Query.java | 8 +++----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/grails-data-hibernate7/grails-plugin/build.gradle b/grails-data-hibernate7/grails-plugin/build.gradle index 8a0245e9b9..56e9b994d5 100644 --- a/grails-data-hibernate7/grails-plugin/build.gradle +++ b/grails-data-hibernate7/grails-plugin/build.gradle @@ -38,7 +38,6 @@ ext { } dependencies { - // TODO: Clarify and clean up dependencies implementation platform(project(':grails-hibernate7-bom')) api 'org.springframework.boot:spring-boot' diff --git a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/FirstAndLastMethodSpec.groovy b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/FirstAndLastMethodSpec.groovy index 95ec922219..2b86c982f0 100644 --- a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/FirstAndLastMethodSpec.groovy +++ b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/FirstAndLastMethodSpec.groovy @@ -168,10 +168,10 @@ class FirstAndLastMethodSpec extends GrailsDataTckSpec { ) void "Test first and last method with composite key"() { given: - assert new PersonWithCompositeKey(firstName: 'Steve', lastName: 'Harris', age: 56).save(failOnError: true) - assert new PersonWithCompositeKey(firstName: 'Dave', lastName: 'Murray', age: 54).save(failOnError: true) - assert new PersonWithCompositeKey(firstName: 'Adrian', lastName: 'Smith', age: 55).save(failOnError: true) - assert new PersonWithCompositeKey(firstName: 'Bruce', lastName: 'Dickinson', age: 53).save(failOnError: true, flush: true) + assert new PersonWithCompositeKey(firstName: 'Steve', lastName: 'Harris', age: 56).save() + assert new PersonWithCompositeKey(firstName: 'Dave', lastName: 'Murray', age: 54).save() + assert new PersonWithCompositeKey(firstName: 'Adrian', lastName: 'Smith', age: 55).save() + assert new PersonWithCompositeKey(firstName: 'Bruce', lastName: 'Dickinson', age: 53).save(flush: true) assert PersonWithCompositeKey.count() == 4 when: diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/Query.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/Query.java index dc4b5da29e..baf2225986 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/Query.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/Query.java @@ -631,12 +631,10 @@ public abstract class Query implements Cloneable, Serializable { // a simple count() projection returns incorrect results because it // appends to the existing projections rather than replacing them. // Fall back to counting the grouped result rows. - // TODO: This needs resolved properly in Grails 8 with Hibernate 7's - // JpaSelectCriteria.from(Subquery) support for derived tables. + // Hibernate 7 resolves this via HibernateQuery.countResults() using derived-table subqueries. logger.warn("DetachedCriteria.count() with user-defined projections cannot use a SQL count query " + - "due to a Hibernate 5 limitation. All grouped result rows will be loaded into memory to " + - "determine the count. This may impact performance on large result sets. " + - "This will be resolved in Grails 8 (Hibernate 7) which supports derived table subqueries."); + "due to a datastore limitation. All grouped result rows will be loaded into memory to " + + "determine the count. This may impact performance on large result sets."); return list().size(); } projections().count();
