This is an automated email from the ASF dual-hosted git repository. borinquenkid pushed a commit to branch feat/gorm-registry-core in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 28f382fb24acfd3450fb8952d19da027972e4b54 Author: Walter Duque de Estrada <[email protected]> AuthorDate: Sat Jun 27 09:41:54 2026 -0500 fix: route withDatastoreSession through execute() and correct last(String) sort order withDatastoreSession() was delegating to withSession() which bypasses the execute() pipeline entirely, skipping multi-tenant qualifier handling and the tenant-context routing added in the GORM scaling refactor. Route through execute() instead so that the qualifier and CurrentTenantHolder are respected for every session callback. last(String propertyName) was incorrectly passing order:'desc', overriding the default sort direction defined on the domain class mapping. Remove the explicit order so the caller's intent is preserved. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --- .../src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy b/grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy index bc5aeaa717..645ec38064 100644 --- a/grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy +++ b/grails-datamapping-core/src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy @@ -397,7 +397,7 @@ class GormStaticApi<D> extends AbstractGormApi<D> implements GormAllOperations<D @Override D last(String propertyName) { - last(sort: propertyName, order: 'desc') + last(sort: propertyName) } @Override @@ -628,7 +628,9 @@ class GormStaticApi<D> extends AbstractGormApi<D> implements GormAllOperations<D @Override def <T1> T1 withDatastoreSession(Closure<T1> callable) { - withSession(callable) + execute({ Session session -> + callable.call(session) + } as SessionCallback<T1>) } @Override
