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/06/22 18:12:08 UTC

(grails-core) 01/12: Fix review comments: remove debug prints, unused import, redundant @Issue refs, Hibernate 6 → 7 messages

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

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

commit 7922d4655b428c6e91004a8a733332dcf79bce94
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Mon Jun 22 11:22:22 2026 -0500

    Fix review comments: remove debug prints, unused import, redundant @Issue refs, Hibernate 6 → 7 messages
    
    - HibernateSpec: remove 5 debug println calls; @AutoCleanup('close') → @AutoCleanup
    - HibernateDatastoreMultiTenancySpec: remove unused Tenants import
    - SaveWithInvalidEntitySpec: drop redundant @Issue #10604 (redirects to #14616)
    - SubclassMultipleListCollectionSpec: drop @Issue for grails-data-mapping/issues/882 (redirects to #14624);
      restore @Ignore with explanation — test still fails with MappingException (repeated column iteration_id),
      #14624 is not fixed in this PR
    - HibernatePersistenceContextInterceptor: "Hibernate 6" → "Hibernate 7" in both UnsupportedOperationException messages
    
    Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
 .../grails/gorm/tests/SubclassMultipleListCollectionSpec.groovy   | 5 ++---
 .../grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy | 3 +--
 .../orm/hibernate/HibernateDatastoreMultiTenancySpec.groovy       | 1 -
 .../src/main/groovy/grails/test/hibernate/HibernateSpec.groovy    | 8 +-------
 .../hibernate/support/HibernatePersistenceContextInterceptor.java | 4 ++--
 5 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/SubclassMultipleListCollectionSpec.groovy b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/SubclassMultipleListCollectionSpec.groovy
index 57dc8c77db..66262f46b3 100644
--- a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/SubclassMultipleListCollectionSpec.groovy
+++ b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/SubclassMultipleListCollectionSpec.groovy
@@ -27,7 +27,7 @@ import spock.lang.*
 /**
  * Created by graemerocher on 01/03/2017.
  */
-@Ignore
+@Ignore // https://github.com/apache/grails-core/issues/14624 — MappingException: Repeated column (iteration_id) for Product; not fixed in this PR
 class SubclassMultipleListCollectionSpec extends Specification {
 
     @AutoCleanup @Shared HibernateDatastore hibernateDatastore
@@ -42,8 +42,7 @@ class SubclassMultipleListCollectionSpec extends Specification {
     }
 
     @Rollback
-    @Issue(['https://github.com/apache/grails-data-mapping/issues/882',
-            'https://github.com/apache/grails-core/issues/14624'])
+    @Issue('https://github.com/apache/grails-core/issues/14624')
     void "test inheritance with multiple list collections"() {
         when:
         Iteration iter = new Iteration()
diff --git a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy
index e27de17360..6e8d99a659 100644
--- a/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy
+++ b/grails-data-hibernate5/core/src/test/groovy/grails/gorm/tests/validation/SaveWithInvalidEntitySpec.groovy
@@ -35,8 +35,7 @@ class SaveWithInvalidEntitySpec extends Specification {
     @Shared @AutoCleanup HibernateDatastore hibernateDatastore = new HibernateDatastore(A, B)
 
     @Rollback
-    @Issue(['https://github.com/apache/grails-core/issues/10604',
-            'https://github.com/apache/grails-core/issues/14616'])
+    @Issue('https://github.com/apache/grails-core/issues/14616')
     void "test save with an invalid entity"() {
         given:
         def b = new B(field2: "test")
diff --git a/grails-data-hibernate5/core/src/test/groovy/org/grails/orm/hibernate/HibernateDatastoreMultiTenancySpec.groovy b/grails-data-hibernate5/core/src/test/groovy/org/grails/orm/hibernate/HibernateDatastoreMultiTenancySpec.groovy
index e2fd76ad9d..7f39c621c4 100644
--- a/grails-data-hibernate5/core/src/test/groovy/org/grails/orm/hibernate/HibernateDatastoreMultiTenancySpec.groovy
+++ b/grails-data-hibernate5/core/src/test/groovy/org/grails/orm/hibernate/HibernateDatastoreMultiTenancySpec.groovy
@@ -20,7 +20,6 @@ package org.grails.orm.hibernate
 
 import grails.gorm.MultiTenant
 import grails.gorm.annotation.Entity
-import grails.gorm.multitenancy.Tenants
 import grails.gorm.tests.HibernateGormDatastoreSpec
 import org.grails.datastore.mapping.multitenancy.MultiTenancySettings
 import org.grails.datastore.mapping.multitenancy.resolvers.SystemPropertyTenantResolver
diff --git a/grails-data-hibernate7/grails-plugin/src/main/groovy/grails/test/hibernate/HibernateSpec.groovy b/grails-data-hibernate7/grails-plugin/src/main/groovy/grails/test/hibernate/HibernateSpec.groovy
index d1464e9829..763dfe62d7 100644
--- a/grails-data-hibernate7/grails-plugin/src/main/groovy/grails/test/hibernate/HibernateSpec.groovy
+++ b/grails-data-hibernate7/grails-plugin/src/main/groovy/grails/test/hibernate/HibernateSpec.groovy
@@ -75,7 +75,7 @@ abstract class HibernateSpec extends Specification {
     @Shared @AutoCleanup HibernateDatastore hibernateDatastore
     @Shared PlatformTransactionManager transactionManager
     @Shared HibernateProxyHandler proxyHandler = new HibernateProxyHandler()
-    @Shared @AutoCleanup('close') ApplicationContext applicationContext
+    @Shared @AutoCleanup ApplicationContext applicationContext
 
     static class TestGrailsBytecodeProvider extends GrailsBytecodeProvider {
 
@@ -101,7 +101,6 @@ abstract class HibernateSpec extends Specification {
         HibernateDatastoreSpringInitializer initializer
 
         if (applicationContext == null) {
-            System.out.println('HibernateSpec: applicationContext is null, creating new one.')
             List<PropertySourceLoader> propertySourceLoaders = SpringFactoriesLoader.loadFactories(PropertySourceLoader, getClass().getClassLoader())
             ResourceLoader resourceLoader = new DefaultResourceLoader()
             MutablePropertySources propertySources = new MutablePropertySources()
@@ -140,13 +139,10 @@ abstract class HibernateSpec extends Specification {
 
             applicationContext = initializer.configure()
         } else {
-            System.out.println("HibernateSpec: applicationContext already exists (${applicationContext.class.name}), registering beans.")
             // Context already exists (e.g. from ControllerUnitTest), register our beans into it
             try {
                 config = applicationContext.getBean('grailsConfig', Config)
             } catch (e) {
-                // Fallback: create a new config if grailsConfig bean is missing
-                System.out.println('HibernateSpec: grailsConfig bean not found, creating fallback.')
                 List<PropertySourceLoader> propertySourceLoaders = SpringFactoriesLoader.loadFactories(PropertySourceLoader, getClass().getClassLoader())
                 ResourceLoader resourceLoader = new DefaultResourceLoader()
                 MutablePropertySources propertySources = new MutablePropertySources()
@@ -182,11 +178,9 @@ abstract class HibernateSpec extends Specification {
             try {
                 hibernateDatastore = applicationContext.getBean('hibernateDatastore', HibernateDatastore)
             } catch (e2) {
-                System.err.println('Available beans: ' + applicationContext.getBeanDefinitionNames().join(', '))
                 throw e2
             }
         }
-        System.out.println("HibernateDatastore initialized with multi-tenancy mode: ${hibernateDatastore.multiTenancyMode}")
         try {
             transactionManager = hibernateDatastore.getTransactionManager()
         } catch (e) {
diff --git a/grails-data-hibernate7/grails-plugin/src/main/groovy/org/grails/plugin/hibernate/support/HibernatePersistenceContextInterceptor.java b/grails-data-hibernate7/grails-plugin/src/main/groovy/org/grails/plugin/hibernate/support/HibernatePersistenceContextInterceptor.java
index d75543dab1..80ab8baa08 100644
--- a/grails-data-hibernate7/grails-plugin/src/main/groovy/org/grails/plugin/hibernate/support/HibernatePersistenceContextInterceptor.java
+++ b/grails-data-hibernate7/grails-plugin/src/main/groovy/org/grails/plugin/hibernate/support/HibernatePersistenceContextInterceptor.java
@@ -104,11 +104,11 @@ public class HibernatePersistenceContextInterceptor
     }
 
     public void disconnect() {
-        throw new UnsupportedOperationException("disconnect is not supported by Hibernate 6");
+        throw new UnsupportedOperationException("disconnect is not supported by Hibernate 7");
     }
 
     public void reconnect() {
-        throw new UnsupportedOperationException("reconnect is not supported by Hibernate 6");
+        throw new UnsupportedOperationException("reconnect is not supported by Hibernate 7");
     }
 
     public void flush() {