This is an automated email from the ASF dual-hosted git repository.

davydotcom pushed a commit to branch fix-detachedcriteria-join-get-hibernate7
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 72cbb2f598a4df569a0bd26e148396693458c4f4
Author: David Estes <[email protected]>
AuthorDate: Wed Feb 25 18:11:58 2026 -0500

    adding one more test spec
---
 .../gorm/specs/DetachedCriteriaJoinSpec.groovy     | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git 
a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/specs/DetachedCriteriaJoinSpec.groovy
 
b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/specs/DetachedCriteriaJoinSpec.groovy
index 1beabf3a83..ad028f391f 100644
--- 
a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/specs/DetachedCriteriaJoinSpec.groovy
+++ 
b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/specs/DetachedCriteriaJoinSpec.groovy
@@ -128,4 +128,34 @@ class DetachedCriteriaJoinSpec extends 
GrailsDataTckSpec<GrailsDataHibernate5Tck
         then:
         result == 'Inter'
     }
+
+    def 'check list with association subquery plus join and projection 
works'() {
+        given:
+        def club = new Club(name: 'Ajax').save(flush: true)
+        new Team(name: 'Amsterdammers', club: club).save(flush: true)
+
+        when:
+        def result = Team.where {
+            club {
+                name == 'Ajax'
+            }
+        }.join('club').property('club.name').list()
+
+        then:
+        result == ['Ajax']
+    }
+
+    def 'check list can sort by joined association property'() {
+        given:
+        def clubA = new Club(name: 'A Club').save(flush: true)
+        def clubB = new Club(name: 'B Club').save(flush: true)
+        new Team(name: 'Team B', club: clubB).save(flush: true)
+        new Team(name: 'Team A', club: clubA).save(flush: true)
+
+        when:
+        def result = Team.where {}.join('club').sort('club.name', 
'asc').property('name').list()
+
+        then:
+        result == ['Team A', 'Team B']
+    }
 }

Reply via email to