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

borinquenkid pushed a commit to branch 9.0.x-remove-h5
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit f041923fc2ac9f3520693bb519ec45cdfe9f7ebc
Author: Walter Duque de Estrada <[email protected]>
AuthorDate: Sat Oct 10 22:40:18 2026 -0500

    test(graphql): expect the SQL Hibernate 7 generates in the test app
    
    CommentIntegrationSpec, TagIntegrationSpec and UserRoleIntegrationSpec 
matched the SQL text
    of Hibernate 5 (this_ aliases, a trailing limit, inner join). Hibernate 7 
generates the same
    queries with c1_0 style aliases, no limit for a lookup by id, and a left 
join for a to-one
    association, so the patterns follow that. The queries and their count are 
unchanged.
    
    Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
---
 .../groovy/grails/test/app/CommentIntegrationSpec.groovy              | 4 ++--
 .../integration-test/groovy/grails/test/app/TagIntegrationSpec.groovy | 4 ++--
 .../groovy/grails/test/app/UserRoleIntegrationSpec.groovy             | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/CommentIntegrationSpec.groovy
 
b/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/CommentIntegrationSpec.groovy
index e20784dfdf..760f140099 100644
--- 
a/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/CommentIntegrationSpec.groovy
+++ 
b/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/CommentIntegrationSpec.groovy
@@ -140,7 +140,7 @@ class CommentIntegrationSpec extends Specification 
implements GraphQLSpec {
         obj.parentComment.id == 1
         outCount == 1
         // Hibernate column ordering varies between versions; assert 
structurally instead.
-        queries[0] ==~ 'Hibernate: select .*this_\\.parent_comment_id.*from 
comment this_ where this_\\.id=\\? limit \\?\n'
+        queries[0] ==~ 'Hibernate: select .*c1_0\\.parent_comment_id.*from 
comment c1_0 where c1_0\\.id=\\?\n'
 
         when:
         outCount = 0
@@ -162,7 +162,7 @@ class CommentIntegrationSpec extends Specification 
implements GraphQLSpec {
         obj.parentComment.text == 'First comment'
         outCount == 1
         // Hibernate column ordering varies between versions; assert 
structurally instead.
-        queries[0] ==~ 'Hibernate: select .*from comment this_ left outer join 
comment comment2_ on this_\\.parent_comment_id=comment2_\\.id where 
this_\\.id=\\?\n'
+        queries[0] ==~ 'Hibernate: select .*from comment c1_0 left join 
comment pc1_0 on pc1_0\\.id=c1_0\\.parent_comment_id where c1_0\\.id=\\?\n'
 
         cleanup:
         System.setOut(originalOut)
diff --git 
a/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/TagIntegrationSpec.groovy
 
b/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/TagIntegrationSpec.groovy
index 5ec7a3a240..8c0a85b03a 100644
--- 
a/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/TagIntegrationSpec.groovy
+++ 
b/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/TagIntegrationSpec.groovy
@@ -150,8 +150,8 @@ class TagIntegrationSpec extends Specification implements 
GraphQLSpec {
 
         then:
         //queries.size() == 2 ignored due to GORM issue 
https://github.com/apache/grails-data-mapping/issues/989
-        queries[0] ==~ 'Hibernate: select this_.id as id[0-9]+_[0-9]+_[0-9]+_, 
this_.version as version[0-9]+_[0-9]+_[0-9]+_, this_.name as 
name[0-9]+_[0-9]+_[0-9]+_ from tag this_ where this_.id=\\? limit \\?\n'
-        queries[1] ==~ 'Hibernate: select this_.id as id[0-9]+_[0-9]+_[0-9]+_, 
this_.version as version[0-9]+_[0-9]+_[0-9]+_, this_.title as 
title[0-9]+_[0-9]+_[0-9]+_, this_.date_created as 
date_cre[0-9]+_[0-9]+_[0-9]+_, this_.last_updated as 
last_upd[0-9]+_[0-9]+_[0-9]+_, tags3_.post_tags_id as post_tag[0-9]+_[0-9]+_, 
tags_alias1_.id as tag_id[0-9]+_[0-9]+_, tags_alias1_.id as 
id[0-9]+_[0-9]+_[0-9]+_, tags_alias1_.version as version[0-9]+_[0-9]+_[0-9]+_, 
tags_alias1_.name as name[0-9]+ [...]
+        queries[0] ==~ 'Hibernate: select t1_0\\.id,t1_0\\.name,t1_0\\.version 
from tag t1_0 where t1_0\\.id=\\?\n'
+        queries[1] ==~ 'Hibernate: select .*from post p1_0 left join post_tag 
t1_0 on p1_0\\.id=t1_0\\.post_tags_id left join tag t1_1 on 
t1_1\\.id=t1_0\\.tag_id join post_tag t2_0 on p1_0\\.id=t2_0\\.post_tags_id 
where t2_0\\.tag_id=\\?\n'
 
         cleanup:
         System.setOut(originalOut)
diff --git 
a/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/UserRoleIntegrationSpec.groovy
 
b/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/UserRoleIntegrationSpec.groovy
index ebf7e37d59..c1ad4d075f 100644
--- 
a/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/UserRoleIntegrationSpec.groovy
+++ 
b/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/UserRoleIntegrationSpec.groovy
@@ -141,7 +141,7 @@ class UserRoleIntegrationSpec extends Specification 
implements GraphQLSpec {
         obj.user.id == userId
         obj.role.id == roleId
         outCount == 1
-        query ==~ 'Hibernate: select this_.user_id as 
user_id[0-9]+_[0-9]+_[0-9]+_, this_.role_id as role_id[0-9]+_[0-9]+_[0-9]+_ 
from user_role this_ where this_.user_id=\\? and this_.role_id=\\? limit \\?\n'
+        query ==~ 'Hibernate: select ur1_0\\.role_id,ur1_0\\.user_id from 
user_role ur1_0 where ur1_0\\.user_id=\\? and ur1_0\\.role_id=\\?\n'
 
         when:
         outCount = 0
@@ -167,7 +167,7 @@ class UserRoleIntegrationSpec extends Specification 
implements GraphQLSpec {
         outCount == 1
         // Hibernate column ordering varies between versions; the User domain 
is mapped
         // to `app_user` because `user` is a reserved keyword in modern H2.
-        query ==~ 'Hibernate: select .*from user_role this_ inner join 
app_user user2_ on this_\\.user_id=user2_\\.id inner join role role3_ on 
this_\\.role_id=role3_\\.id where this_\\.user_id=\\? and this_\\.role_id=\\?\n'
+        query ==~ 'Hibernate: select .*from user_role ur1_0 left join role 
r1_0 on r1_0\\.id=ur1_0\\.role_id left join app_user u1_0 on 
u1_0\\.id=ur1_0\\.user_id where ur1_0\\.user_id=\\? and ur1_0\\.role_id=\\?\n'
 
         cleanup:
         System.setOut(originalOut)

Reply via email to