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:09 UTC

(grails-core) 02/12: Restore getDefaultDataSource/getDatasourceNames/usesDatasource with @Deprecated(forRemoval=true)

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 6ab209dba100d364a1d83a83fbb0a28e8d0b4128
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Mon Jun 22 11:33:40 2026 -0500

    Restore getDefaultDataSource/getDatasourceNames/usesDatasource with @Deprecated(forRemoval=true)
    
    These three public static methods were removed in H5 GrailsHibernateUtil without
    first going through the forRemoval = true step. Restore them as proper
    @Deprecated(forRemoval = true) delegates to MultipleDataSourceSupport so external
    callers get a deprecation warning before removal.
    
    Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
 .../orm/hibernate/cfg/GrailsHibernateUtil.java     | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java b/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java
index e5c4e8f700..75641911a8 100644
--- a/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java
+++ b/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java
@@ -18,6 +18,7 @@
  */
 package org.grails.orm.hibernate.cfg;
 
+import java.util.List;
 import java.util.Map;
 
 import groovy.lang.GroovyObject;
@@ -50,6 +51,7 @@ import org.grails.datastore.mapping.model.types.Association;
 import org.grails.datastore.mapping.model.types.Embedded;
 import org.grails.datastore.mapping.reflect.ClassUtils;
 import org.grails.orm.hibernate.AbstractHibernateDatastore;
+import org.grails.orm.hibernate.datasource.MultipleDataSourceSupport;
 import org.grails.orm.hibernate.proxy.HibernateProxyHandler;
 import org.grails.orm.hibernate.support.HibernateRuntimeUtils;
 
@@ -420,6 +422,30 @@ public class GrailsHibernateUtil extends HibernateRuntimeUtils {
         return proxyHandler.unwrap(instance);
     }
 
+    /**
+     * @deprecated Use {@link MultipleDataSourceSupport#getDefaultDataSource(PersistentEntity)} instead.
+     */
+    @Deprecated(forRemoval = true)
+    public static String getDefaultDataSource(PersistentEntity domainClass) {
+        return MultipleDataSourceSupport.getDefaultDataSource(domainClass);
+    }
+
+    /**
+     * @deprecated Use {@link MultipleDataSourceSupport#getDatasourceNames(PersistentEntity)} instead.
+     */
+    @Deprecated(forRemoval = true)
+    public static List<String> getDatasourceNames(PersistentEntity domainClass) {
+        return MultipleDataSourceSupport.getDatasourceNames(domainClass);
+    }
+
+    /**
+     * @deprecated Use {@link MultipleDataSourceSupport#usesDatasource(PersistentEntity, String)} instead.
+     */
+    @Deprecated(forRemoval = true)
+    public static boolean usesDatasource(PersistentEntity domainClass, String dataSourceName) {
+        return MultipleDataSourceSupport.usesDatasource(domainClass, dataSourceName);
+    }
+
     public static boolean isMappedWithHibernate(PersistentEntity domainClass) {
         return domainClass instanceof HibernatePersistentEntity;
     }