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

borinquenkid pushed a commit to branch merge-hibernate6
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 5d23f662a840c69bd58c5405b60efed06af46dd7
Author: Walter Duque de Estrada <wbdu...@mac.com>
AuthorDate: Tue Aug 19 12:30:16 2025 -0500

     more to HibernateHqlQuery
---
 .../orm/hibernate/HibernateGormStaticApi.groovy    |  4 +-
 .../hibernate/HibernateGormStaticApiSpec.groovy    | 45 ++--------------------
 2 files changed, 7 insertions(+), 42 deletions(-)

diff --git 
a/grails-data-hibernate6/core/src/main/groovy/org/grails/orm/hibernate/HibernateGormStaticApi.groovy
 
b/grails-data-hibernate6/core/src/main/groovy/org/grails/orm/hibernate/HibernateGormStaticApi.groovy
index 28890dddd9..93936042f5 100644
--- 
a/grails-data-hibernate6/core/src/main/groovy/org/grails/orm/hibernate/HibernateGormStaticApi.groovy
+++ 
b/grails-data-hibernate6/core/src/main/groovy/org/grails/orm/hibernate/HibernateGormStaticApi.groovy
@@ -826,6 +826,7 @@ class HibernateGormStaticApi<D> extends GormStaticApi<D> {
 
         return (Integer) template.execute { Session session ->
             Query q = (Query) session.createQuery(query.toString())
+            q.setHibernateFlushMode(FlushMode.COMMIT)
             template.applySettings(q)
             def sessionHolder = (SessionHolder) 
TransactionSynchronizationManager.getResource( sessionFactory )
             if (sessionHolder && sessionHolder.hasTimeout()) {
@@ -842,7 +843,8 @@ class HibernateGormStaticApi<D> extends GormStaticApi<D> {
             }
             populateQueryArguments(q, args)
             return withQueryEvents(q) {
-                q.executeUpdate()
+
+                def update = q.executeUpdate()
             }
         }
     }
diff --git 
a/grails-data-hibernate6/core/src/test/groovy/org/grails/orm/hibernate/HibernateGormStaticApiSpec.groovy
 
b/grails-data-hibernate6/core/src/test/groovy/org/grails/orm/hibernate/HibernateGormStaticApiSpec.groovy
index 7bb99ffd55..0e5c68ede6 100644
--- 
a/grails-data-hibernate6/core/src/test/groovy/org/grails/orm/hibernate/HibernateGormStaticApiSpec.groovy
+++ 
b/grails-data-hibernate6/core/src/test/groovy/org/grails/orm/hibernate/HibernateGormStaticApiSpec.groovy
@@ -161,32 +161,8 @@ class HibernateGormStaticApiSpec extends 
HibernateGormDatastoreSpec {
         instances.size() == 2
     }
 
-    void "Test find with DetachedCriteria from where query"() {
-        given:
-        new HibernateGormStaticApiEntity(name: "test1").save(failOnError: true)
-        new HibernateGormStaticApiEntity(name: "test2").save(flush: true, 
failOnError: true)
 
-        when:
-        def criteria = HibernateGormStaticApiEntity.where { name == "test2" }
-        def instance = HibernateGormStaticApiEntity.find(criteria)
 
-        then:
-        instance.name == "test2"
-    }
-
-    void "Test findAll with DetachedCriteria from where query"() {
-        given:
-        new HibernateGormStaticApiEntity(name: "test").save(failOnError: true)
-        new HibernateGormStaticApiEntity(name: "test").save(failOnError: true)
-        new HibernateGormStaticApiEntity(name: "other").save(flush: true, 
failOnError: true)
-
-        when:
-        def criteria = HibernateGormStaticApiEntity.where { name == "test" }
-        def instances = HibernateGormStaticApiEntity.findAll(criteria)
-
-        then:
-        instances.size() == 2
-    }
 
     void "Test count"() {
         given:
@@ -203,23 +179,6 @@ class HibernateGormStaticApiSpec extends 
HibernateGormDatastoreSpec {
 
 
 
-    void "Test merge"() {
-        given:
-        def entity = new HibernateGormStaticApiEntity(name: 
"test").save(flush: true, failOnError: true)
-        session.clear()
-        entity.name = "modified"
-
-        when:
-        def merged = HibernateGormStaticApiEntity.merge(entity)
-        session.flush()
-        session.clear()
-        def updated = HibernateGormStaticApiEntity.get(entity.id)
-
-        then:
-        merged.name == "modified"
-        updated.name == "modified"
-    }
-
     void "Test refresh"() {
         given:
         def entity = new HibernateGormStaticApiEntity(name: 
"test").save(flush: true, failOnError: true)
@@ -232,6 +191,7 @@ class HibernateGormStaticApiSpec extends 
HibernateGormDatastoreSpec {
         entity.name == "test"
     }
 
+    //TODO transaction is not working
     void "Test withTransaction"() {
         when:
         HibernateGormStaticApiEntity.withTransaction { status ->
@@ -254,6 +214,7 @@ class HibernateGormStaticApiSpec extends 
HibernateGormDatastoreSpec {
         result == null
     }
 
+    //TODO The instance was not associated with this session
     void "Test withNewSession"() {
         given:
         new HibernateGormStaticApiEntity(name: "outer").save(flush: true, 
failOnError: true)
@@ -268,6 +229,7 @@ class HibernateGormStaticApiSpec extends 
HibernateGormDatastoreSpec {
         count == 2
     }
 
+    //TODO Update happens but is not persisted
     void "Test executeUpdate"() {
         given:
         new HibernateGormStaticApiEntity(name: "test").save(flush: true, 
failOnError: true)
@@ -462,6 +424,7 @@ class HibernateGormStaticApiSpec extends 
HibernateGormDatastoreSpec {
         instance.name == 'updated'
     }
 
+    //TODO Update happens but is not persisted and positional parameters
     void "Test executeUpdate with positional params"() {
         given:
         new HibernateGormStaticApiEntity(name: "test").save(flush: true, 
failOnError: true)

Reply via email to