You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by bo...@apache.org on 2026/04/03 14:05:16 UTC
(grails-core) branch 8.0.x-hibernate7-dev updated (93c5928bf2 -> 78b8b36725)
This is an automated email from the ASF dual-hosted git repository.
borinquenkid pushed a change to branch 8.0.x-hibernate7-dev
in repository https://gitbox.apache.org/repos/asf/grails-core.git
from 93c5928bf2 test: DetachedCriteria list returns PagedResultList only when max is set
new 6382464dc0 fix: remove double populateArgumentsForCriteria call in DetachedCriteria.list
new 945c907210 fix: PagedResultList totalCount leaks ORDER BY into COUNT query on H2
new 8c2ae2efd4 test: restore multi-row validation for findAll* boolean property finders
new eaacee2a60 H7: incorrect messages
add f026c56f2f fix: address review feedback and architectural improvements for Spring Boot 4 upgrade
add 9598b9de07 Merge remote-tracking branch 'origin/spring-boot-4' into 8.0.x-hibernate7
new 78b8b36725 Merge branch '8.0.x-hibernate7' into 8.0.x-hibernate7-dev
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
NOTICE | 8 ++-
.../org/apache/grails/buildsrc/SbomPlugin.groovy | 4 ++
build.gradle | 8 ---
dependencies.gradle | 4 +-
.../boot4-disabled-integration-test-config.gradle | 31 +++++------
gradle/publish-root-config.gradle | 2 +-
grails-controllers/build.gradle | 4 +-
grails-data-hibernate5/core/build.gradle | 7 +--
grails-data-hibernate5/spring-orm/build.gradle | 61 ++++++++++++++++++++++
.../hibernate5/ConfigurableJtaPlatform.java | 0
.../support/hibernate5/HibernateCallback.java | 0
.../hibernate5/HibernateExceptionTranslator.java | 0
.../support/hibernate5/HibernateJdbcException.java | 0
.../HibernateObjectRetrievalFailureException.java | 0
.../support/hibernate5/HibernateOperations.java | 0
...HibernateOptimisticLockingFailureException.java | 0
.../hibernate5/HibernateQueryException.java | 0
.../hibernate5/HibernateSystemException.java | 0
.../support/hibernate5/HibernateTemplate.java | 0
.../hibernate5/HibernateTransactionManager.java | 0
.../hibernate5/LocalSessionFactoryBean.java | 0
.../hibernate5/LocalSessionFactoryBuilder.java | 0
.../support/hibernate5/SessionFactoryUtils.java | 0
.../support/hibernate5/SessionHolder.java | 0
.../support/hibernate5/SpringBeanContainer.java | 0
.../hibernate5/SpringFlushSynchronization.java | 0
.../hibernate5/SpringJtaSessionContext.java | 0
.../support/hibernate5/SpringSessionContext.java | 0
.../hibernate5/SpringSessionSynchronization.java | 0
.../support/AsyncRequestInterceptor.java | 0
.../support/OpenSessionInViewInterceptor.java | 0
.../domainbinding/binder/CompositeIdBinder.java | 2 +-
.../cfg/domainbinding/binder/SimpleIdBinder.java | 2 +-
.../grails/orm/hibernate/query/HibernateQuery.java | 14 ++---
.../grails/gorm/specs/PagedResultListSpec.groovy | 19 +++++++
.../specs/hibernatequery/HibernateQuerySpec.groovy | 16 ++++++
.../groovy/grails/gorm/DetachedCriteria.groovy | 7 ++-
.../main/groovy/grails/gorm/PagedResultList.java | 1 +
.../testing/tck/tests/DetachedCriteriaSpec.groovy | 18 +++++++
.../data/testing/tck/tests/FindByMethodSpec.groovy | 22 +++-----
.../org/grails/datastore/mapping/query/Query.java | 9 ++++
.../web/taglib/AbstractGrailsTagTests.groovy | 15 ------
grails-gsp/spring-boot/build.gradle | 6 ++-
grails-spring/build.gradle | 5 --
.../AbstractGrailsMockHttpServletResponse.groovy | 6 +--
grails-test-examples/app1/build.gradle | 7 +--
grails-test-examples/app3/build.gradle | 7 +--
grails-test-examples/exploded/build.gradle | 7 +--
.../groovy/GrailsLayoutSpec.groovy | 2 +-
.../views/gsp/layout/AbstractGrailsTagTests.groovy | 15 ------
grails-test-examples/gsp-sitemesh3/build.gradle | 7 +--
.../mongodb/test-data-service/build.gradle | 7 +--
grails-test-examples/plugins/exploded/build.gradle | 7 +--
.../plugins/micronaut-singleton/build.gradle | 5 --
.../grails/testing/GrailsApplicationBuilder.groovy | 60 ++++++++-------------
.../boot/EmbeddedContainerWithGrailsSpec.groovy | 8 ++-
.../grails/boot/GrailsSpringApplicationSpec.groovy | 8 ++-
.../mvc/UrlMappingsInfoHandlerAdapter.groovy | 1 -
settings.gradle | 3 ++
59 files changed, 220 insertions(+), 195 deletions(-)
copy grails-data-neo4j/grails-datastore-gorm-neo4j/src/main/groovy/org/grails/datastore/gorm/neo4j/SessionFlushedEvent.java => gradle/boot4-disabled-integration-test-config.gradle (55%)
create mode 100644 grails-data-hibernate5/spring-orm/build.gradle
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/ConfigurableJtaPlatform.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateCallback.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateExceptionTranslator.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateJdbcException.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateObjectRetrievalFailureException.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateOperations.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateOptimisticLockingFailureException.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateQueryException.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateSystemException.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateTemplate.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateTransactionManager.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/LocalSessionFactoryBean.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/LocalSessionFactoryBuilder.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/SessionFactoryUtils.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/SessionHolder.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/SpringBeanContainer.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/SpringFlushSynchronization.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/SpringJtaSessionContext.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/SpringSessionContext.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/SpringSessionSynchronization.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/support/AsyncRequestInterceptor.java (100%)
rename grails-data-hibernate5/{core => spring-orm}/src/main/java/org/grails/orm/hibernate/support/hibernate5/support/OpenSessionInViewInterceptor.java (100%)
(grails-core) 02/05: fix: PagedResultList totalCount leaks ORDER BY into COUNT query on H2
Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
borinquenkid pushed a commit to branch 8.0.x-hibernate7-dev
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 945c907210d8a34788c1491b08925e06b0fbc50e
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Fri Apr 3 08:43:38 2026 -0500
fix: PagedResultList totalCount leaks ORDER BY into COUNT query on H2
- Add Query.clearOrders() to core — clears orderBy list; subclasses override
- Override HibernateQuery.clearOrders() to also clear JPA detachedCriteria orders,
replacing the TODO HACK that used order(null) to piggyback order clearing
- HibernateQuery.order() now unconditionally delegates to detachedCriteria (no null check)
- PagedResultList.initialize() calls clearOrders() on cloned query before COUNT,
replacing the direct orderBy.clear() which missed HibernateQuery's JPA orders
- DetachedCriteria.list() uses protected newPagedResultList() factory method
- Tests: HibernateQuerySpec (clearOrders), PagedResultListSpec (DetachedCriteria
sort+max totalCount), DetachedCriteriaSpec TCK (sort+max+totalCount)
Co-authored-by: Copilot <22...@users.noreply.github.com>
---
.../grails/orm/hibernate/query/HibernateQuery.java | 14 ++++++++------
.../grails/gorm/specs/PagedResultListSpec.groovy | 19 +++++++++++++++++++
.../specs/hibernatequery/HibernateQuerySpec.groovy | 16 ++++++++++++++++
.../main/groovy/grails/gorm/DetachedCriteria.groovy | 6 +++++-
.../src/main/groovy/grails/gorm/PagedResultList.java | 1 +
.../testing/tck/tests/DetachedCriteriaSpec.groovy | 3 ++-
.../org/grails/datastore/mapping/query/Query.java | 9 +++++++++
7 files changed, 60 insertions(+), 8 deletions(-)
diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/query/HibernateQuery.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/query/HibernateQuery.java
index 65cd06e1df..a363357fbc 100644
--- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/query/HibernateQuery.java
+++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/query/HibernateQuery.java
@@ -388,12 +388,14 @@ public class HibernateQuery extends Query {
@Override
public Query order(Order order) {
- // TODO HACK
- if (order == null) {
- detachedCriteria.getOrders().clear();
- } else {
- detachedCriteria.order(order);
- }
+ detachedCriteria.order(order);
+ return this;
+ }
+
+ @Override
+ public Query clearOrders() {
+ detachedCriteria.getOrders().clear();
+ super.clearOrders();
return this;
}
diff --git a/grails-data-hibernate7/core/src/test/groovy/grails/gorm/specs/PagedResultListSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/grails/gorm/specs/PagedResultListSpec.groovy
index 79a873b266..96c8034e85 100644
--- a/grails-data-hibernate7/core/src/test/groovy/grails/gorm/specs/PagedResultListSpec.groovy
+++ b/grails-data-hibernate7/core/src/test/groovy/grails/gorm/specs/PagedResultListSpec.groovy
@@ -90,6 +90,25 @@ class PagedResultListSpec extends HibernateGormDatastoreSpec {
results[0].title == "The Shining"
results[1].title == "The Stand"
}
+ void "test PagedResultList totalCount via DetachedCriteria with sort does not leak ORDER BY into count"() {
+ given:
+ new PRLBook(title: "The Stand").save()
+ new PRLBook(title: "The Shining").save()
+ new PRLBook(title: "Carrie").save()
+ session.flush()
+ session.clear()
+
+ when:
+ def criteria = new grails.gorm.DetachedCriteria(PRLBook)
+ def results = criteria.list(sort: 'title', order: 'asc', max: 2)
+
+ then:
+ results instanceof PagedResultList
+ results.size() == 2
+ results.totalCount == 3
+ results[0].title == 'Carrie'
+ results[1].title == 'The Shining'
+ }
}
@Entity
diff --git a/grails-data-hibernate7/core/src/test/groovy/grails/gorm/specs/hibernatequery/HibernateQuerySpec.groovy b/grails-data-hibernate7/core/src/test/groovy/grails/gorm/specs/hibernatequery/HibernateQuerySpec.groovy
index ffea0a300e..5a119e683c 100644
--- a/grails-data-hibernate7/core/src/test/groovy/grails/gorm/specs/hibernatequery/HibernateQuerySpec.groovy
+++ b/grails-data-hibernate7/core/src/test/groovy/grails/gorm/specs/hibernatequery/HibernateQuerySpec.groovy
@@ -1003,6 +1003,22 @@ class HibernateQuerySpec extends HibernateGormDatastoreSpec {
cloned.hibernateCriteria != null
}
+ def "cloneQuery with order then clearOrders produces no ORDER BY in count"() {
+ given:
+ new Person(firstName: "Fred", lastName: "Builder", age: 48).save(flush: true)
+ hibernateQuery.eq("lastName", "Builder")
+ .order(new Query.Order("firstName", Query.Order.Direction.ASC))
+
+ when:
+ HibernateQuery cloned = (HibernateQuery) hibernateQuery.clone()
+ cloned.clearOrders()
+ cloned.projections().count()
+ Number count = (Number) cloned.singleResult()
+
+ then:
+ count == 2
+ }
+
def queryArguments() {
given:
hibernateQuery.setFetchSize(100)
diff --git a/grails-datamapping-core/src/main/groovy/grails/gorm/DetachedCriteria.groovy b/grails-datamapping-core/src/main/groovy/grails/gorm/DetachedCriteria.groovy
index c49a553cfb..bf8387c685 100644
--- a/grails-datamapping-core/src/main/groovy/grails/gorm/DetachedCriteria.groovy
+++ b/grails-datamapping-core/src/main/groovy/grails/gorm/DetachedCriteria.groovy
@@ -136,12 +136,16 @@ class DetachedCriteria<T> extends AbstractDetachedCriteria<T> implements GormOpe
List<T> list(Map args = Collections.emptyMap(), @DelegatesTo(DetachedCriteria) Closure additionalCriteria = null) {
(List)withPopulatedQuery(args, additionalCriteria) { Query query ->
if (args?.max) {
- return new PagedResultList(query)
+ return newPagedResultList(query)
}
return query.list()
}
}
+ protected PagedResultList<T> newPagedResultList(Query query) {
+ new PagedResultList<T>(query)
+ }
+
/**
* Lists all records matching the criterion contained within this DetachedCriteria instance
*
diff --git a/grails-datamapping-core/src/main/groovy/grails/gorm/PagedResultList.java b/grails-datamapping-core/src/main/groovy/grails/gorm/PagedResultList.java
index f59e1dcad6..a9a9aad503 100644
--- a/grails-datamapping-core/src/main/groovy/grails/gorm/PagedResultList.java
+++ b/grails-datamapping-core/src/main/groovy/grails/gorm/PagedResultList.java
@@ -106,6 +106,7 @@ public class PagedResultList<E> implements PagedList<E> {
Query newQuery = (Query) query.clone();
newQuery.offset(0);
newQuery.max(-1);
+ newQuery.clearOrders();
newQuery.projections().count();
Number result = (Number) newQuery.singleResult();
totalCount = result == null ? 0 : result.intValue();
diff --git a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/DetachedCriteriaSpec.groovy b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/DetachedCriteriaSpec.groovy
index 57f1c9e6ff..541ccb3d97 100644
--- a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/DetachedCriteriaSpec.groovy
+++ b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/DetachedCriteriaSpec.groovy
@@ -130,8 +130,9 @@ class DetachedCriteriaSpec extends GrailsDataTckSpec {
}
def results = criteria.list(sort: 'firstName', order: 'asc', max: 4)
- then: 'Results are a PagedResultList sorted correctly without duplicate order clauses'
+ then: 'Results are a PagedResultList sorted correctly, totalCount does not include ORDER BY'
results instanceof PagedResultList
+ results.totalCount == 4
results.size() == 4
results*.firstName == ['Bart', 'Homer', 'Lisa', 'Marge']
}
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 a778e2e020..df795cd042 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
@@ -296,6 +296,15 @@ public abstract class Query implements Cloneable {
return this;
}
+ /**
+ * Clears all order entries from this query.
+ * Subclasses that store orders in additional structures (e.g. JPA criteria) should override this.
+ */
+ public Query clearOrders() {
+ orderBy.clear();
+ return this;
+ }
+
/**
* Gets the Order entries for this query
* @return The order entries
(grails-core) 04/05: H7: incorrect messages
Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
borinquenkid pushed a commit to branch 8.0.x-hibernate7-dev
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit eaacee2a607814fbfacd9d569449f49aed2786a7
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Fri Apr 3 09:04:15 2026 -0500
H7: incorrect messages
---
.../orm/hibernate/cfg/domainbinding/binder/CompositeIdBinder.java | 2 +-
.../grails/orm/hibernate/cfg/domainbinding/binder/SimpleIdBinder.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/CompositeIdBinder.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/CompositeIdBinder.java
index cebf65afda..cf27edd717 100644
--- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/CompositeIdBinder.java
+++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/CompositeIdBinder.java
@@ -57,7 +57,7 @@ public class CompositeIdBinder {
}
return;
}
- throw new MappingException("Invalid simple id binding for entity [" + domainClass.getName() + "]");
+ throw new MappingException("Invalid composite id binding for entity [" + domainClass.getName() + "]");
}
private @NonNull Component getComponent(@NonNull HibernatePersistentEntity domainClass) {
diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/SimpleIdBinder.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/SimpleIdBinder.java
index 642fcf946f..36c2156be3 100644
--- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/SimpleIdBinder.java
+++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/SimpleIdBinder.java
@@ -82,6 +82,6 @@ public class SimpleIdBinder {
pkTable.setPrimaryKey(new PrimaryKey(pkTable));
return;
}
- throw new MappingException("Invalid composite id binding for entity [" + domainClass.getName() + "]");
+ throw new MappingException("Invalid simple id binding for entity [" + domainClass.getName() + "]");
}
}
(grails-core) 03/05: test: restore multi-row validation for findAll* boolean property finders
Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
borinquenkid pushed a commit to branch 8.0.x-hibernate7-dev
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 8c2ae2efd4c41be35df9104922e617812021937f
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Fri Apr 3 08:51:34 2026 -0500
test: restore multi-row validation for findAll* boolean property finders
Add a second bypassed and not-bypassed Highway row so findAllBypassed()
and findAllNotBypassed() actually validate multi-row behavior.
Replace findNotBypassed()/findBypassed() singular calls (which now
throw NonUniqueResultException with 2 rows) with findBypassedByName/
findNotBypassedByName to keep singular finders unambiguous.
Co-authored-by: Copilot <22...@users.noreply.github.com>
---
.../data/testing/tck/tests/FindByMethodSpec.groovy | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/FindByMethodSpec.groovy b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/FindByMethodSpec.groovy
index 36d0b891bf..3e8c2006c6 100644
--- a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/FindByMethodSpec.groovy
+++ b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/FindByMethodSpec.groovy
@@ -123,7 +123,9 @@ class FindByMethodSpec extends GrailsDataTckSpec {
void testBooleanPropertyQuery() {
given:
new Highway(bypassed: true, name: 'Bypassed Highway').save()
+ new Highway(bypassed: true, name: 'Another Bypassed Highway').save()
new Highway(bypassed: false, name: 'Not Bypassed Highway').save()
+ new Highway(bypassed: false, name: 'Another Not Bypassed Highway').save()
when:
def highways = Highway.findAllBypassedByName('Not Bypassed Highway')
@@ -153,27 +155,17 @@ class FindByMethodSpec extends GrailsDataTckSpec {
when:
highways = Highway.findAllBypassed()
then:
- 1 == highways?.size()
- 'Bypassed Highway' == highways[0].name
+ 2 == highways?.size()
+ highways*.name.containsAll(['Bypassed Highway', 'Another Bypassed Highway'])
when:
highways = Highway.findAllNotBypassed()
then:
- 1 == highways?.size()
- 'Not Bypassed Highway' == highways[0].name
-
- when:
- def highway = Highway.findNotBypassed()
- then:
- 'Not Bypassed Highway' == highway?.name
-
- when:
- highway = Highway.findBypassed()
- then:
- 'Bypassed Highway' == highway?.name
+ 2 == highways?.size()
+ highways*.name.containsAll(['Not Bypassed Highway', 'Another Not Bypassed Highway'])
when:
- highway = Highway.findNotBypassedByName('Not Bypassed Highway')
+ def highway = Highway.findNotBypassedByName('Not Bypassed Highway')
then:
'Not Bypassed Highway' == highway?.name
(grails-core) 05/05: Merge branch '8.0.x-hibernate7' into 8.0.x-hibernate7-dev
Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
borinquenkid pushed a commit to branch 8.0.x-hibernate7-dev
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 78b8b36725f368363cc6955bc393dc57438b85a7
Merge: eaacee2a60 9598b9de07
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Fri Apr 3 09:05:01 2026 -0500
Merge branch '8.0.x-hibernate7' into 8.0.x-hibernate7-dev
NOTICE | 8 ++-
.../org/apache/grails/buildsrc/SbomPlugin.groovy | 4 ++
build.gradle | 8 ---
dependencies.gradle | 4 +-
.../boot4-disabled-integration-test-config.gradle | 32 ++++++++++++
gradle/publish-root-config.gradle | 2 +-
grails-controllers/build.gradle | 4 +-
grails-data-hibernate5/core/build.gradle | 7 +--
grails-data-hibernate5/spring-orm/build.gradle | 61 ++++++++++++++++++++++
.../hibernate5/ConfigurableJtaPlatform.java | 0
.../support/hibernate5/HibernateCallback.java | 0
.../hibernate5/HibernateExceptionTranslator.java | 0
.../support/hibernate5/HibernateJdbcException.java | 0
.../HibernateObjectRetrievalFailureException.java | 0
.../support/hibernate5/HibernateOperations.java | 0
...HibernateOptimisticLockingFailureException.java | 0
.../hibernate5/HibernateQueryException.java | 0
.../hibernate5/HibernateSystemException.java | 0
.../support/hibernate5/HibernateTemplate.java | 0
.../hibernate5/HibernateTransactionManager.java | 0
.../hibernate5/LocalSessionFactoryBean.java | 0
.../hibernate5/LocalSessionFactoryBuilder.java | 0
.../support/hibernate5/SessionFactoryUtils.java | 0
.../support/hibernate5/SessionHolder.java | 0
.../support/hibernate5/SpringBeanContainer.java | 0
.../hibernate5/SpringFlushSynchronization.java | 0
.../hibernate5/SpringJtaSessionContext.java | 0
.../support/hibernate5/SpringSessionContext.java | 0
.../hibernate5/SpringSessionSynchronization.java | 0
.../support/AsyncRequestInterceptor.java | 0
.../support/OpenSessionInViewInterceptor.java | 0
.../web/taglib/AbstractGrailsTagTests.groovy | 15 ------
grails-gsp/spring-boot/build.gradle | 6 ++-
grails-spring/build.gradle | 5 --
.../AbstractGrailsMockHttpServletResponse.groovy | 6 +--
grails-test-examples/app1/build.gradle | 7 +--
grails-test-examples/app3/build.gradle | 7 +--
grails-test-examples/exploded/build.gradle | 7 +--
.../groovy/GrailsLayoutSpec.groovy | 2 +-
.../views/gsp/layout/AbstractGrailsTagTests.groovy | 15 ------
grails-test-examples/gsp-sitemesh3/build.gradle | 7 +--
.../mongodb/test-data-service/build.gradle | 7 +--
grails-test-examples/plugins/exploded/build.gradle | 7 +--
.../plugins/micronaut-singleton/build.gradle | 5 --
.../grails/testing/GrailsApplicationBuilder.groovy | 60 ++++++++-------------
.../boot/EmbeddedContainerWithGrailsSpec.groovy | 8 ++-
.../grails/boot/GrailsSpringApplicationSpec.groovy | 8 ++-
.../mvc/UrlMappingsInfoHandlerAdapter.groovy | 1 -
settings.gradle | 3 ++
49 files changed, 154 insertions(+), 152 deletions(-)
(grails-core) 01/05: fix: remove double populateArgumentsForCriteria call in DetachedCriteria.list
Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
borinquenkid pushed a commit to branch 8.0.x-hibernate7-dev
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 6382464dc0486c1ce196f7e321cde83eec255bdd
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Fri Apr 3 08:19:51 2026 -0500
fix: remove double populateArgumentsForCriteria call in DetachedCriteria.list
withPopulatedQuery already calls populateArgumentsForCriteria unconditionally.
The extra call inside the args?.max branch caused duplicate ORDER BY clauses
since Query.order() is additive (orderBy.add). Remove the redundant call.
Add test to verify sort+max returns results in correct order exactly once.
Co-authored-by: Copilot <22...@users.noreply.github.com>
---
.../src/main/groovy/grails/gorm/DetachedCriteria.groovy | 1 -
.../data/testing/tck/tests/DetachedCriteriaSpec.groovy | 17 +++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/grails-datamapping-core/src/main/groovy/grails/gorm/DetachedCriteria.groovy b/grails-datamapping-core/src/main/groovy/grails/gorm/DetachedCriteria.groovy
index 78f2dd30a4..c49a553cfb 100644
--- a/grails-datamapping-core/src/main/groovy/grails/gorm/DetachedCriteria.groovy
+++ b/grails-datamapping-core/src/main/groovy/grails/gorm/DetachedCriteria.groovy
@@ -136,7 +136,6 @@ class DetachedCriteria<T> extends AbstractDetachedCriteria<T> implements GormOpe
List<T> list(Map args = Collections.emptyMap(), @DelegatesTo(DetachedCriteria) Closure additionalCriteria = null) {
(List)withPopulatedQuery(args, additionalCriteria) { Query query ->
if (args?.max) {
- DynamicFinder.populateArgumentsForCriteria(targetClass, query, args)
return new PagedResultList(query)
}
return query.list()
diff --git a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/DetachedCriteriaSpec.groovy b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/DetachedCriteriaSpec.groovy
index 1bac3ab7ea..57f1c9e6ff 100644
--- a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/DetachedCriteriaSpec.groovy
+++ b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/DetachedCriteriaSpec.groovy
@@ -119,6 +119,23 @@ class DetachedCriteriaSpec extends GrailsDataTckSpec {
}
+ void 'Test list method with sort and max applies sort exactly once'() {
+ given: 'A bunch of people'
+ createPeople()
+
+ when: 'list is called with sort and max'
+ def criteria = new DetachedCriteria(Person)
+ criteria.with {
+ eq 'lastName', 'Simpson'
+ }
+ def results = criteria.list(sort: 'firstName', order: 'asc', max: 4)
+
+ then: 'Results are a PagedResultList sorted correctly without duplicate order clauses'
+ results instanceof PagedResultList
+ results.size() == 4
+ results*.firstName == ['Bart', 'Homer', 'Lisa', 'Marge']
+ }
+
void 'Test exists method'() {
given: 'A bunch of people'
createPeople()