jamesfredley commented on code in PR #15425:
URL: https://github.com/apache/grails-core/pull/15425#discussion_r2847560085


##########
grails-data-hibernate5/grails-plugin/src/main/groovy/org/grails/plugin/hibernate/support/GrailsOpenSessionInViewInterceptor.java:
##########
@@ -84,5 +179,25 @@ public void 
setHibernateDatastore(AbstractHibernateDatastore hibernateDatastore)
             this.hibernateFlushMode = FlushMode.valueOf(defaultFlushModeName);
         }
         setSessionFactory(hibernateDatastore.getSessionFactory());
+
+        if (hibernateDatastore instanceof HibernateDatastore) {
+            HibernateDatastore hibernateDs = (HibernateDatastore) 
hibernateDatastore;
+            for (ConnectionSource<SessionFactory, 
HibernateConnectionSourceSettings> connectionSource : 
hibernateDs.getConnectionSources().getAllConnectionSources()) {
+                String connectionName = connectionSource.getName();
+                if (!ConnectionSource.DEFAULT.equals(connectionName)) {
+                    AbstractHibernateDatastore childDatastore = 
hibernateDs.getDatastoreForConnection(connectionName);
+                    FlushMode childFlushMode;
+                    if (childDatastore.isOsivReadOnly()) {
+                        childFlushMode = FlushMode.MANUAL;
+                    }
+                    else {
+                        childFlushMode = 
FlushMode.valueOf(childDatastore.getDefaultFlushModeName());
+                    }
+                    additionalSessionFactories.add(
+                            new 
AdditionalSessionFactoryConfig(childDatastore.getSessionFactory(), 
childFlushMode)

Review Comment:
   Already addressed in f22dc661a4 - `AdditionalSessionFactoryConfig` now 
stores `connectionName` and all debug/error log messages include the datasource 
name across `preHandle`, `postHandle`, and `afterCompletion`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to