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

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

commit 3696e6983561728e798d23fe280f3ff3d00fd815
Author: Walter Duque de Estrada <[email protected]>
AuthorDate: Tue Mar 10 11:43:42 2026 -0500

    hibernate 7:  further linting and testing
---
 .../DatabaseMigrationTransactionManager.groovy     |   2 +-
 ...plicationContextDatabaseMigrationCommand.groovy |   2 +-
 .../liquibase/EmbeddedJarPathHandler.groovy        |   2 +-
 .../liquibase/GormColumnSnapshotGenerator.groovy   |  12 +-
 .../liquibase/GormDatabase.groovy                  |   6 +-
 .../liquibase/GroovyChangeLogParser.groovy         |   2 +-
 .../liquibase/GroovyChangeLogSerializer.groovy     |   2 +-
 .../database/HibernateClassicDatabase.java         |   4 +-
 .../ext/hibernate/database/HibernateDatabase.java  |  16 +-
 .../hibernate/database/HibernateEjb3Database.java  |   8 +-
 .../database/HibernateSpringBeanDatabase.java      |   2 +-
 .../database/HibernateSpringPackageDatabase.java   |  11 +-
 .../hibernate/database/JpaPersistenceDatabase.java |  11 +-
 .../hibernate/database/NoOpConnectionProvider.java |   6 +-
 .../NoOpMultiTenantConnectionProvider.java         |  12 +-
 .../database/connection/HibernateConnection.java   | 118 ++++---
 .../connection/HibernateConnectionMetadata.java    | 350 ++++++++++-----------
 .../database/connection/HibernateDriver.java       |   6 +-
 .../snapshot/ColumnSnapshotGenerator.java          |   2 +-
 .../DatabaseMigrationGrailsPluginSpec.groovy       | 167 ++++++++++
 20 files changed, 444 insertions(+), 297 deletions(-)

diff --git 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/DatabaseMigrationTransactionManager.groovy
 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/DatabaseMigrationTransactionManager.groovy
index eabb3b549e..dee7d92904 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/DatabaseMigrationTransactionManager.groovy
+++ 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/DatabaseMigrationTransactionManager.groovy
@@ -140,6 +140,6 @@ class DatabaseMigrationTransactionManager {
             return
         }
 
-        new GrailsTransactionTemplate(transactionManager, 
definition).execute(callable)
+        new GrailsTransactionTemplate(transactionManager as 
PlatformTransactionManager, definition).execute(callable)
     }
 }
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/command/ApplicationContextDatabaseMigrationCommand.groovy
 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/command/ApplicationContextDatabaseMigrationCommand.groovy
index 26c4a9cf7c..3299da1e5e 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/command/ApplicationContextDatabaseMigrationCommand.groovy
+++ 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/command/ApplicationContextDatabaseMigrationCommand.groovy
@@ -95,7 +95,7 @@ trait ApplicationContextDatabaseMigrationCommand implements 
DatabaseMigrationCom
         HibernateDatastore hibernateDatastore = 
applicationContext.getBean('hibernateDatastore', HibernateDatastore)
         hibernateDatastore = 
hibernateDatastore.getDatastoreForConnection(dataSource)
 
-        Database database = new GormDatabase(dialect, serviceRegistry, 
hibernateDatastore)
+        Database database = new GormDatabase(dialect, hibernateDatastore)
         configureDatabase(database)
 
         return database
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/EmbeddedJarPathHandler.groovy
 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/EmbeddedJarPathHandler.groovy
index bfba3ce565..324ba9b382 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/EmbeddedJarPathHandler.groovy
+++ 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/EmbeddedJarPathHandler.groovy
@@ -45,7 +45,7 @@ class EmbeddedJarPathHandler extends ZipPathHandler {
         PRIORITY_NOT_APPLICABLE
     }
 
-    private String parseJarPath(String root) {
+    private static String parseJarPath(String root) {
         root.substring(9, root.lastIndexOf('!'))
     }
 
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GormColumnSnapshotGenerator.groovy
 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GormColumnSnapshotGenerator.groovy
index c96daea53a..6f0d70de59 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GormColumnSnapshotGenerator.groovy
+++ 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GormColumnSnapshotGenerator.groovy
@@ -62,7 +62,7 @@ class GormColumnSnapshotGenerator implements 
SnapshotGenerator {
     }
 
     @Override
-    public <T extends DatabaseObject> T snapshot(T example, DatabaseSnapshot 
snapshot, SnapshotGeneratorChain chain) {
+    <T extends DatabaseObject> T snapshot(T example, DatabaseSnapshot 
snapshot, SnapshotGeneratorChain chain) {
         T snapshotObject = chain.snapshot(example, snapshot)
 
         if (!(snapshotObject instanceof Column) || !(snapshot.database 
instanceof GormDatabase)) {
@@ -98,7 +98,7 @@ class GormColumnSnapshotGenerator implements 
SnapshotGenerator {
         return snapshotObject
     }
 
-    protected PersistentClass findPersistentClass(Metadata metadata, String 
tableName) {
+    protected static PersistentClass findPersistentClass(Metadata metadata, 
String tableName) {
         for (PersistentClass pc : metadata.entityBindings) {
             if (tableName.equalsIgnoreCase(pc.table?.name)) {
                 return pc
@@ -107,7 +107,7 @@ class GormColumnSnapshotGenerator implements 
SnapshotGenerator {
         return null
     }
 
-    protected boolean isIdentifier(PersistentClass pc, String columnName) {
+    protected static boolean isIdentifier(PersistentClass pc, String 
columnName) {
         if (!(pc instanceof RootClass)) return false
         RootClass root = (RootClass) pc
         if (!(root.identifier instanceof SimpleValue)) return false
@@ -117,7 +117,7 @@ class GormColumnSnapshotGenerator implements 
SnapshotGenerator {
         }
     }
 
-    protected PersistentProperty 
resolveGormProperty(GrailsHibernatePersistentEntity gpe, String columnName) {
+    protected static PersistentProperty 
resolveGormProperty(GrailsHibernatePersistentEntity gpe, String columnName) {
         for (PersistentProperty prop : gpe.hibernatePersistentProperties) {
             String propColumnName = null
             if (prop instanceof HibernatePersistentProperty) {
@@ -136,7 +136,7 @@ class GormColumnSnapshotGenerator implements 
SnapshotGenerator {
         return null
     }
 
-    protected void applyGormIdentitySettings(Column column, 
GrailsHibernatePersistentEntity gpe) {
+    protected static void applyGormIdentitySettings(Column column, 
GrailsHibernatePersistentEntity gpe) {
         // Always set identifiers as non-nullable
         column.setNullable(false)
         
@@ -152,7 +152,7 @@ class GormColumnSnapshotGenerator implements 
SnapshotGenerator {
         }
     }
 
-    protected void applyGormPropertySettings(Column column, PersistentProperty 
prop) {
+    protected static void applyGormPropertySettings(Column column, 
PersistentProperty prop) {
         if (column.isNullable() == null || column.isNullable()) {
             if (!prop.isNullable()) {
                 column.setNullable(false)
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GormDatabase.groovy
 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GormDatabase.groovy
index 303a98485a..a2c23238f9 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GormDatabase.groovy
+++ 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GormDatabase.groovy
@@ -31,7 +31,6 @@ import liquibase.structure.DatabaseObject
 import org.hibernate.boot.Metadata
 import org.hibernate.boot.MetadataSources
 import org.hibernate.dialect.Dialect
-import org.hibernate.service.ServiceRegistry
 
 import org.grails.orm.hibernate.HibernateDatastore
 
@@ -46,10 +45,9 @@ class GormDatabase extends HibernateDatabase {
     private HibernateDatastore gormDatastore
     DatabaseConnection connection
 
-    GormDatabase() {
-    }
 
-    GormDatabase(Dialect dialect, ServiceRegistry serviceRegistry, 
HibernateDatastore hibernateDatastore) {
+
+    GormDatabase(Dialect dialect, HibernateDatastore hibernateDatastore) {
         this.dialect = dialect
         this.metadata = hibernateDatastore.getMetadata()
         this.gormDatastore = hibernateDatastore
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GroovyChangeLogParser.groovy
 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GroovyChangeLogParser.groovy
index 0083c7aa80..ce94c92f45 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GroovyChangeLogParser.groovy
+++ 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GroovyChangeLogParser.groovy
@@ -89,7 +89,7 @@ class GroovyChangeLogParser extends AbstractChangeLogParser {
     }
 
     @CompileDynamic
-    protected void setChangeLogProperties(Map changeLogProperties, 
ChangeLogParameters changeLogParameters) {
+    protected static void setChangeLogProperties(Map changeLogProperties, 
ChangeLogParameters changeLogParameters) {
         changeLogProperties.each { name, value ->
             String contexts = null
             String labels = null
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GroovyChangeLogSerializer.groovy
 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GroovyChangeLogSerializer.groovy
index 162fe79fa5..3e326ddd86 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GroovyChangeLogSerializer.groovy
+++ 
b/grails-data-hibernate7/dbmigration/src/main/groovy/org/grails/plugins/databasemigration/liquibase/GroovyChangeLogSerializer.groovy
@@ -32,7 +32,7 @@ class GroovyChangeLogSerializer implements 
ChangeLogSerializer {
     private XMLChangeLogSerializer xmlChangeLogSerializer = new 
XMLChangeLogSerializer()
 
     @Override
-    def <T extends ChangeLogChild> void write(List<T> changesets, OutputStream 
out) throws IOException {
+    <T extends ChangeLogChild> void write(List<T> changesets, OutputStream 
out) throws IOException {
         def xmlOutputStrem = new ByteArrayOutputStream()
         xmlChangeLogSerializer.write(changesets, xmlOutputStrem)
         out << ChangelogXml2Groovy.convert(xmlOutputStrem.toString())
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateClassicDatabase.java
 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateClassicDatabase.java
index 6aed40339f..58ebc88046 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateClassicDatabase.java
+++ 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateClassicDatabase.java
@@ -17,7 +17,7 @@ public class HibernateClassicDatabase extends 
HibernateDatabase {
 
     protected Configuration configuration;
 
-    public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) 
throws DatabaseException {
+    public boolean isCorrectDatabaseImplementation(DatabaseConnection conn)  {
         return conn.getURL().startsWith("hibernate:classic:");
     }
 
@@ -39,7 +39,7 @@ public class HibernateClassicDatabase extends 
HibernateDatabase {
     }
 
     @Override
-    protected void configureSources(MetadataSources sources) throws 
DatabaseException {
+    protected void configureSources(MetadataSources sources)  {
         Configuration config = new Configuration(sources);
         config.configure(getHibernateConnection().getPath());
 
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateDatabase.java
 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateDatabase.java
index 8764aeb3d0..37e3506401 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateDatabase.java
+++ 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateDatabase.java
@@ -106,7 +106,7 @@ public abstract class HibernateDatabase extends 
AbstractJdbcDatabase {
         DatabaseConnection originalConnection = getConnection();
         if (originalConnection instanceof 
liquibase.database.jvm.JdbcConnection) {
             java.sql.Connection underlyingConnection =
-                    ((liquibase.database.jvm.JdbcConnection) 
originalConnection).getUnderlyingConnection();
+                    originalConnection.getUnderlyingConnection();
             if (underlyingConnection instanceof HibernateConnection) {
                 return (HibernateConnection) underlyingConnection;
             } else {
@@ -347,7 +347,7 @@ public abstract class HibernateDatabase extends 
AbstractJdbcDatabase {
     }
 
     @Override
-    protected String getConnectionCatalogName() throws DatabaseException {
+    protected String getConnectionCatalogName() {
         return getDefaultCatalogName();
     }
 
@@ -367,7 +367,7 @@ public abstract class HibernateDatabase extends 
AbstractJdbcDatabase {
     }
 
     @Override
-    public boolean isSafeToRunUpdate() throws DatabaseException {
+    public boolean isSafeToRunUpdate() {
         return true;
     }
 
@@ -376,13 +376,7 @@ public abstract class HibernateDatabase extends 
AbstractJdbcDatabase {
         return false;
     }
 
-    @Override
-    public boolean supportsSchemas() {
-        return true;
-    }
 
-    @Override
-    public boolean supportsCatalogs() {
-        return true;
-    }
+
+
 }
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateEjb3Database.java
 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateEjb3Database.java
index c91db49f94..e168de3745 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateEjb3Database.java
+++ 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateEjb3Database.java
@@ -83,10 +83,8 @@ public class HibernateEjb3Database extends HibernateDatabase 
{
                 AvailableSettings.USE_NATIONALIZED_CHARACTER_DATA,
                 
getProperty(AvailableSettings.USE_NATIONALIZED_CHARACTER_DATA));
 
-        final EntityManagerFactoryBuilderImpl builder =
-                (EntityManagerFactoryBuilderImpl) 
persistenceProvider.getEntityManagerFactoryBuilderOrNull(
-                        getHibernateConnection().getPath(), properties, null);
-        return builder;
+        return (EntityManagerFactoryBuilderImpl) 
persistenceProvider.getEntityManagerFactoryBuilderOrNull(
+                getHibernateConnection().getPath(), properties, null);
     }
 
     @Override
@@ -117,7 +115,7 @@ public class HibernateEjb3Database extends 
HibernateDatabase {
      * Adds sources based on what is in the saved entityManagerFactory
      */
     @Override
-    protected void configureSources(MetadataSources sources) throws 
DatabaseException {
+    protected void configureSources(MetadataSources sources) {
         for (ManagedType<?> managedType : 
entityManagerFactory.getMetamodel().getManagedTypes()) {
             Class<?> javaType = managedType.getJavaType();
             if (javaType == null) {
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringBeanDatabase.java
 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringBeanDatabase.java
index 768b39ee12..7eefda310f 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringBeanDatabase.java
+++ 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringBeanDatabase.java
@@ -34,7 +34,7 @@ public class HibernateSpringBeanDatabase extends 
HibernateDatabase {
     private BeanDefinition beanDefinition;
     private ManagedProperties beanDefinitionProperties;
 
-    public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) 
throws DatabaseException {
+    public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) {
         return conn.getURL().startsWith("hibernate:spring:");
     }
 
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringPackageDatabase.java
 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringPackageDatabase.java
index e7e23d0df5..99918a8552 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringPackageDatabase.java
+++ 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringPackageDatabase.java
@@ -10,7 +10,6 @@ import jakarta.persistence.spi.PersistenceUnitInfo;
 
 import liquibase.Scope;
 import liquibase.database.DatabaseConnection;
-import liquibase.exception.DatabaseException;
 import liquibase.ext.hibernate.database.connection.HibernateConnection;
 import org.hibernate.bytecode.enhance.spi.EnhancementContext;
 import org.hibernate.cfg.AvailableSettings;
@@ -32,7 +31,7 @@ import 
org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
 public class HibernateSpringPackageDatabase extends JpaPersistenceDatabase {
 
     @Override
-    public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) 
throws DatabaseException {
+    public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) {
         return conn.getURL().startsWith("hibernate:spring:") && 
!isXmlFile(conn);
     }
 
@@ -49,7 +48,7 @@ public class HibernateSpringPackageDatabase extends 
JpaPersistenceDatabase {
         HibernateConnection hibernateConnection;
         if (connection instanceof liquibase.database.jvm.JdbcConnection) {
             Object underlyingConnection =
-                    ((liquibase.database.jvm.JdbcConnection) 
connection).getUnderlyingConnection();
+                    connection.getUnderlyingConnection();
             if (underlyingConnection instanceof HibernateConnection) {
                 hibernateConnection = (HibernateConnection) 
underlyingConnection;
             } else {
@@ -67,11 +66,7 @@ public class HibernateSpringPackageDatabase extends 
JpaPersistenceDatabase {
         }
         ClassPathResource resource = new ClassPathResource(path);
         try {
-            if (resource.exists() && !resource.getFile().isDirectory()) {
-                return true;
-            } else {
-                return false;
-            }
+            return resource.exists() && !resource.getFile().isDirectory();
         } catch (IOException e) {
             return false;
         }
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/JpaPersistenceDatabase.java
 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/JpaPersistenceDatabase.java
index 774ff8aaab..66e9ccd81d 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/JpaPersistenceDatabase.java
+++ 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/JpaPersistenceDatabase.java
@@ -5,7 +5,6 @@ import java.util.Map;
 import jakarta.persistence.spi.PersistenceUnitInfo;
 
 import liquibase.database.DatabaseConnection;
-import liquibase.exception.DatabaseException;
 import liquibase.ext.hibernate.database.connection.HibernateDriver;
 import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl;
 import org.hibernate.jpa.boot.spi.Bootstrap;
@@ -19,7 +18,7 @@ import 
org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager
 public class JpaPersistenceDatabase extends HibernateEjb3Database {
 
     @Override
-    public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) 
throws DatabaseException {
+    public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) {
         return conn.getURL().startsWith("jpa:persistence:");
     }
 
@@ -52,10 +51,8 @@ public class JpaPersistenceDatabase extends 
HibernateEjb3Database {
         internalPersistenceUnitManager.preparePersistenceUnitInfos();
         PersistenceUnitInfo persistenceUnitInfo = 
internalPersistenceUnitManager.obtainDefaultPersistenceUnitInfo();
 
-        EntityManagerFactoryBuilderImpl builder =
-                (EntityManagerFactoryBuilderImpl) 
Bootstrap.getEntityManagerFactoryBuilder(
-                        persistenceUnitInfo,
-                        
Map.of(HibernateDatabase.HIBERNATE_TEMP_USE_JDBC_METADATA_DEFAULTS, 
Boolean.FALSE.toString()));
-        return builder;
+        return (EntityManagerFactoryBuilderImpl) 
Bootstrap.getEntityManagerFactoryBuilder(
+                persistenceUnitInfo,
+                
Map.of(HibernateDatabase.HIBERNATE_TEMP_USE_JDBC_METADATA_DEFAULTS, 
Boolean.FALSE.toString()));
     }
 }
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpConnectionProvider.java
 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpConnectionProvider.java
index 64f60a875c..1808a47f77 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpConnectionProvider.java
+++ 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpConnectionProvider.java
@@ -16,7 +16,7 @@ class NoOpConnectionProvider implements ConnectionProvider {
     }
 
     @Override
-    public void closeConnection(Connection conn) throws SQLException {}
+    public void closeConnection(Connection conn) {}
 
     @Override
     public boolean supportsAggressiveRelease() {
@@ -41,7 +41,7 @@ class NoOpConnectionProvider implements ConnectionProvider {
         return getConnection();
     }
 
-    public void releaseConnection(Object tenantIdentifier, Connection 
connection) throws SQLException {}
+    public void releaseConnection(Object tenantIdentifier, Connection 
connection) {}
 
-    public void releaseConnection(String tenantIdentifier, Connection 
connection) throws SQLException {}
+    public void releaseConnection(String tenantIdentifier, Connection 
connection) {}
 }
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpMultiTenantConnectionProvider.java
 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpMultiTenantConnectionProvider.java
index 6c09cc8ca9..1ea179ef75 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpMultiTenantConnectionProvider.java
+++ 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpMultiTenantConnectionProvider.java
@@ -21,24 +21,24 @@ class NoOpMultiTenantConnectionProvider implements 
MultiTenantConnectionProvider
     }
 
     @Override
-    public Connection getAnyConnection() throws SQLException {
+    public Connection getAnyConnection() {
         return null;
     }
 
     @Override
-    public void releaseAnyConnection(Connection connection) throws 
SQLException {}
+    public void releaseAnyConnection(Connection connection) {}
 
-    public Connection getConnection(String s) throws SQLException {
+    public Connection getConnection(String s) {
         return null;
     }
 
-    public void releaseConnection(String s, Connection connection) throws 
SQLException {}
+    public void releaseConnection(String s, Connection connection) {}
 
-    public Connection getConnection(Object tenantIdentifier) throws 
SQLException {
+    public Connection getConnection(Object tenantIdentifier) {
         return null;
     }
 
-    public void releaseConnection(Object tenantIdentifier, Connection 
connection) throws SQLException {}
+    public void releaseConnection(Object tenantIdentifier, Connection 
connection) {}
 
     @Override
     public boolean supportsAggressiveRelease() {
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnection.java
 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnection.java
index 935e41e322..ffcf9a8554 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnection.java
+++ 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnection.java
@@ -16,12 +16,12 @@ import liquibase.resource.ResourceAccessor;
  * Beyond standard Connection methods, this class exposes {@link 
#getPrefix()}, {@link #getPath()} and {@link #getProperties()} to access the 
setting passed in the JDBC URL.
  */
 public class HibernateConnection implements Connection {
-    private String prefix;
-    private String url;
+    private final String prefix;
+    private final String url;
 
     private String path;
-    private ResourceAccessor resourceAccessor;
-    private Properties properties;
+    private final ResourceAccessor resourceAccessor;
+    private final Properties properties;
 
     public HibernateConnection(String url, ResourceAccessor resourceAccessor) {
         this.url = url;
@@ -101,196 +101,194 @@ public class HibernateConnection implements Connection {
     /// JDBC METHODS
     
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-    public Statement createStatement() throws SQLException {
+    public Statement createStatement() {
         return null;
     }
 
-    public PreparedStatement prepareStatement(String sql) throws SQLException {
+    public PreparedStatement prepareStatement(String sql) {
         return null;
     }
 
-    public CallableStatement prepareCall(String sql) throws SQLException {
+    public CallableStatement prepareCall(String sql) {
         return null;
     }
 
-    public String nativeSQL(String sql) throws SQLException {
+    public String nativeSQL(String sql) {
         return null;
     }
 
-    public void setAutoCommit(boolean autoCommit) throws SQLException {}
+    public void setAutoCommit(boolean autoCommit) {}
 
-    public boolean getAutoCommit() throws SQLException {
+    public boolean getAutoCommit() {
         return false;
     }
 
-    public void commit() throws SQLException {}
+    public void commit() {}
 
-    public void rollback() throws SQLException {}
+    public void rollback() {}
 
-    public void close() throws SQLException {}
+    public void close() {}
 
-    public boolean isClosed() throws SQLException {
+    public boolean isClosed() {
         return false;
     }
 
-    public DatabaseMetaData getMetaData() throws SQLException {
+    public DatabaseMetaData getMetaData() {
         return new HibernateConnectionMetadata(url);
     }
 
-    public void setReadOnly(boolean readOnly) throws SQLException {}
+    public void setReadOnly(boolean readOnly) {}
 
-    public boolean isReadOnly() throws SQLException {
+    public boolean isReadOnly() {
         return true;
     }
 
-    public void setCatalog(String catalog) throws SQLException {}
+    public void setCatalog(String catalog) {}
 
-    public String getCatalog() throws SQLException {
+    public String getCatalog() {
         return "HIBERNATE";
     }
 
-    public void setTransactionIsolation(int level) throws SQLException {}
+    public void setTransactionIsolation(int level) {}
 
-    public int getTransactionIsolation() throws SQLException {
+    public int getTransactionIsolation() {
         return Connection.TRANSACTION_NONE;
     }
 
-    public SQLWarning getWarnings() throws SQLException {
+    public SQLWarning getWarnings() {
         return null;
     }
 
-    public void clearWarnings() throws SQLException {}
+    public void clearWarnings() {}
 
-    public Statement createStatement(int resultSetType, int 
resultSetConcurrency) throws SQLException {
+    public Statement createStatement(int resultSetType, int 
resultSetConcurrency) {
         return null;
     }
 
-    public PreparedStatement prepareStatement(String sql, int resultSetType, 
int resultSetConcurrency)
-            throws SQLException {
+    public PreparedStatement prepareStatement(String sql, int resultSetType, 
int resultSetConcurrency) {
         return null;
     }
 
-    public CallableStatement prepareCall(String sql, int resultSetType, int 
resultSetConcurrency) throws SQLException {
+    public CallableStatement prepareCall(String sql, int resultSetType, int 
resultSetConcurrency) {
         return null;
     }
 
-    public Map<String, Class<?>> getTypeMap() throws SQLException {
+    public Map<String, Class<?>> getTypeMap() {
         return null;
     }
 
-    public void setTypeMap(Map<String, Class<?>> map) throws SQLException {}
+    public void setTypeMap(Map<String, Class<?>> map) {}
 
-    public void setHoldability(int holdability) throws SQLException {}
+    public void setHoldability(int holdability) {}
 
-    public int getHoldability() throws SQLException {
+    public int getHoldability() {
         return 0;
     }
 
-    public Savepoint setSavepoint() throws SQLException {
+    public Savepoint setSavepoint() {
         return null;
     }
 
-    public Savepoint setSavepoint(String name) throws SQLException {
+    public Savepoint setSavepoint(String name) {
         return null;
     }
 
-    public void rollback(Savepoint savepoint) throws SQLException {}
+    public void rollback(Savepoint savepoint) {}
 
-    public void releaseSavepoint(Savepoint savepoint) throws SQLException {}
+    public void releaseSavepoint(Savepoint savepoint) {}
 
-    public Statement createStatement(int resultSetType, int 
resultSetConcurrency, int resultSetHoldability)
-            throws SQLException {
+    public Statement createStatement(int resultSetType, int 
resultSetConcurrency, int resultSetHoldability) {
         return null;
     }
 
     public PreparedStatement prepareStatement(
-            String sql, int resultSetType, int resultSetConcurrency, int 
resultSetHoldability) throws SQLException {
+            String sql, int resultSetType, int resultSetConcurrency, int 
resultSetHoldability) {
         return null;
     }
 
     public CallableStatement prepareCall(
-            String sql, int resultSetType, int resultSetConcurrency, int 
resultSetHoldability) throws SQLException {
+            String sql, int resultSetType, int resultSetConcurrency, int 
resultSetHoldability) {
         return null;
     }
 
-    public PreparedStatement prepareStatement(String sql, int 
autoGeneratedKeys) throws SQLException {
+    public PreparedStatement prepareStatement(String sql, int 
autoGeneratedKeys) {
         return null;
     }
 
-    public PreparedStatement prepareStatement(String sql, int[] columnIndexes) 
throws SQLException {
+    public PreparedStatement prepareStatement(String sql, int[] columnIndexes) 
{
         return null;
     }
 
-    public PreparedStatement prepareStatement(String sql, String[] 
columnNames) throws SQLException {
+    public PreparedStatement prepareStatement(String sql, String[] 
columnNames) {
         return null;
     }
 
-    public Clob createClob() throws SQLException {
+    public Clob createClob() {
         return null;
     }
 
-    public Blob createBlob() throws SQLException {
+    public Blob createBlob() {
         return null;
     }
 
-    public NClob createNClob() throws SQLException {
+    public NClob createNClob() {
         return null;
     }
 
-    public SQLXML createSQLXML() throws SQLException {
+    public SQLXML createSQLXML() {
         return null;
     }
 
-    public boolean isValid(int timeout) throws SQLException {
+    public boolean isValid(int timeout) {
         return false;
     }
 
-    public void setClientInfo(String name, String value) throws 
SQLClientInfoException {}
+    public void setClientInfo(String name, String value) {}
 
-    public void setClientInfo(Properties properties) throws 
SQLClientInfoException {}
+    public void setClientInfo(Properties properties) {}
 
-    public String getClientInfo(String name) throws SQLException {
+    public String getClientInfo(String name) {
         return null;
     }
 
-    public Properties getClientInfo() throws SQLException {
+    public Properties getClientInfo() {
         return null;
     }
 
-    public Array createArrayOf(String typeName, Object[] elements) throws 
SQLException {
+    public Array createArrayOf(String typeName, Object[] elements) {
         return null;
     }
 
-    public Struct createStruct(String typeName, Object[] attributes) throws 
SQLException {
+    public Struct createStruct(String typeName, Object[] attributes) {
         return null;
     }
 
-    public <T> T unwrap(Class<T> iface) throws SQLException {
+    public <T> T unwrap(Class<T> iface) {
         return null;
     }
 
-    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+    public boolean isWrapperFor(Class<?> iface) {
         return false;
     }
 
     // @Override only in java 1.7
-    public void abort(Executor arg0) throws SQLException {}
+    public void abort(Executor arg0) {}
 
     // @Override only in java 1.7
-    public int getNetworkTimeout() throws SQLException {
+    public int getNetworkTimeout() {
         return 0;
     }
 
     // @Override only in java 1.7
-    public String getSchema() throws SQLException {
+    public String getSchema() {
         return "HIBERNATE";
     }
 
     // @Override only in java 1.7
-    public void setNetworkTimeout(Executor arg0, int arg1) throws SQLException 
{}
+    public void setNetworkTimeout(Executor arg0, int arg1) {}
 
     // @Override only in java 1.7
-    public void setSchema(String arg0) throws SQLException {}
+    public void setSchema(String arg0) {}
 
     public ResourceAccessor getResourceAccessor() {
         return resourceAccessor;
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnectionMetadata.java
 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnectionMetadata.java
index a77c8d5874..f6617f7438 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnectionMetadata.java
+++ 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnectionMetadata.java
@@ -10,61 +10,61 @@ import org.hibernate.Version;
  */
 public class HibernateConnectionMetadata implements DatabaseMetaData {
 
-    private String url;
+    private final String url;
 
     public HibernateConnectionMetadata(String url) {
         this.url = url;
     }
 
-    public boolean allProceduresAreCallable() throws SQLException {
+    public boolean allProceduresAreCallable()  {
         return false;
     }
 
-    public boolean allTablesAreSelectable() throws SQLException {
+    public boolean allTablesAreSelectable()  {
         return false;
     }
 
-    public String getURL() throws SQLException {
+    public String getURL()  {
         return url;
     }
 
-    public String getUserName() throws SQLException {
+    public String getUserName()  {
         return null;
     }
 
-    public boolean isReadOnly() throws SQLException {
+    public boolean isReadOnly()  {
         return true;
     }
 
-    public boolean nullsAreSortedHigh() throws SQLException {
+    public boolean nullsAreSortedHigh()  {
         return false;
     }
 
-    public boolean nullsAreSortedLow() throws SQLException {
+    public boolean nullsAreSortedLow()  {
         return false;
     }
 
-    public boolean nullsAreSortedAtStart() throws SQLException {
+    public boolean nullsAreSortedAtStart()  {
         return false;
     }
 
-    public boolean nullsAreSortedAtEnd() throws SQLException {
+    public boolean nullsAreSortedAtEnd()  {
         return false;
     }
 
-    public String getDatabaseProductName() throws SQLException {
+    public String getDatabaseProductName()  {
         return "Hibernate";
     }
 
-    public String getDatabaseProductVersion() throws SQLException {
+    public String getDatabaseProductVersion()  {
         return Version.getVersionString();
     }
 
-    public String getDriverName() throws SQLException {
+    public String getDriverName()  {
         return null;
     }
 
-    public String getDriverVersion() throws SQLException {
+    public String getDriverVersion()  {
         return "0";
     }
 
@@ -76,479 +76,479 @@ public class HibernateConnectionMetadata implements 
DatabaseMetaData {
         return 0;
     }
 
-    public boolean usesLocalFiles() throws SQLException {
+    public boolean usesLocalFiles()  {
         return false;
     }
 
-    public boolean usesLocalFilePerTable() throws SQLException {
+    public boolean usesLocalFilePerTable()  {
         return false;
     }
 
-    public boolean supportsMixedCaseIdentifiers() throws SQLException {
+    public boolean supportsMixedCaseIdentifiers()  {
         return false;
     }
 
-    public boolean storesUpperCaseIdentifiers() throws SQLException {
+    public boolean storesUpperCaseIdentifiers()  {
         return false;
     }
 
-    public boolean storesLowerCaseIdentifiers() throws SQLException {
+    public boolean storesLowerCaseIdentifiers()  {
         return false;
     }
 
-    public boolean storesMixedCaseIdentifiers() throws SQLException {
+    public boolean storesMixedCaseIdentifiers()  {
         return false;
     }
 
-    public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
+    public boolean supportsMixedCaseQuotedIdentifiers()  {
         return false;
     }
 
-    public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
+    public boolean storesUpperCaseQuotedIdentifiers()  {
         return false;
     }
 
-    public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
+    public boolean storesLowerCaseQuotedIdentifiers()  {
         return false;
     }
 
-    public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
+    public boolean storesMixedCaseQuotedIdentifiers()  {
         return false;
     }
 
-    public String getIdentifierQuoteString() throws SQLException {
+    public String getIdentifierQuoteString()  {
         return null;
     }
 
-    public String getSQLKeywords() throws SQLException {
+    public String getSQLKeywords()  {
         return ""; // do not return null here due to 
liquibase.database.jvm.JdbcConnection:30 to avoid NPE's there
     }
 
-    public String getNumericFunctions() throws SQLException {
+    public String getNumericFunctions()  {
         return null;
     }
 
-    public String getStringFunctions() throws SQLException {
+    public String getStringFunctions()  {
         return null;
     }
 
-    public String getSystemFunctions() throws SQLException {
+    public String getSystemFunctions()  {
         return null;
     }
 
-    public String getTimeDateFunctions() throws SQLException {
+    public String getTimeDateFunctions()  {
         return null;
     }
 
-    public String getSearchStringEscape() throws SQLException {
+    public String getSearchStringEscape()  {
         return null;
     }
 
-    public String getExtraNameCharacters() throws SQLException {
+    public String getExtraNameCharacters()  {
         return null;
     }
 
-    public boolean supportsAlterTableWithAddColumn() throws SQLException {
+    public boolean supportsAlterTableWithAddColumn()  {
         return false;
     }
 
-    public boolean supportsAlterTableWithDropColumn() throws SQLException {
+    public boolean supportsAlterTableWithDropColumn()  {
         return false;
     }
 
-    public boolean supportsColumnAliasing() throws SQLException {
+    public boolean supportsColumnAliasing()  {
         return false;
     }
 
-    public boolean nullPlusNonNullIsNull() throws SQLException {
+    public boolean nullPlusNonNullIsNull()  {
         return false;
     }
 
-    public boolean supportsConvert() throws SQLException {
+    public boolean supportsConvert()  {
         return false;
     }
 
-    public boolean supportsConvert(int fromType, int toType) throws 
SQLException {
+    public boolean supportsConvert(int fromType, int toType)  {
         return false;
     }
 
-    public boolean supportsTableCorrelationNames() throws SQLException {
+    public boolean supportsTableCorrelationNames()  {
         return false;
     }
 
-    public boolean supportsDifferentTableCorrelationNames() throws 
SQLException {
+    public boolean supportsDifferentTableCorrelationNames()  {
         return false;
     }
 
-    public boolean supportsExpressionsInOrderBy() throws SQLException {
+    public boolean supportsExpressionsInOrderBy()  {
         return false;
     }
 
-    public boolean supportsOrderByUnrelated() throws SQLException {
+    public boolean supportsOrderByUnrelated()  {
         return false;
     }
 
-    public boolean supportsGroupBy() throws SQLException {
+    public boolean supportsGroupBy()  {
         return false;
     }
 
-    public boolean supportsGroupByUnrelated() throws SQLException {
+    public boolean supportsGroupByUnrelated()  {
         return false;
     }
 
-    public boolean supportsGroupByBeyondSelect() throws SQLException {
+    public boolean supportsGroupByBeyondSelect()  {
         return false;
     }
 
-    public boolean supportsLikeEscapeClause() throws SQLException {
+    public boolean supportsLikeEscapeClause()  {
         return false;
     }
 
-    public boolean supportsMultipleResultSets() throws SQLException {
+    public boolean supportsMultipleResultSets()  {
         return false;
     }
 
-    public boolean supportsMultipleTransactions() throws SQLException {
+    public boolean supportsMultipleTransactions()  {
         return false;
     }
 
-    public boolean supportsNonNullableColumns() throws SQLException {
+    public boolean supportsNonNullableColumns()  {
         return false;
     }
 
-    public boolean supportsMinimumSQLGrammar() throws SQLException {
+    public boolean supportsMinimumSQLGrammar()  {
         return false;
     }
 
-    public boolean supportsCoreSQLGrammar() throws SQLException {
+    public boolean supportsCoreSQLGrammar()  {
         return false;
     }
 
-    public boolean supportsExtendedSQLGrammar() throws SQLException {
+    public boolean supportsExtendedSQLGrammar()  {
         return false;
     }
 
-    public boolean supportsANSI92EntryLevelSQL() throws SQLException {
+    public boolean supportsANSI92EntryLevelSQL()  {
         return false;
     }
 
-    public boolean supportsANSI92IntermediateSQL() throws SQLException {
+    public boolean supportsANSI92IntermediateSQL()  {
         return false;
     }
 
-    public boolean supportsANSI92FullSQL() throws SQLException {
+    public boolean supportsANSI92FullSQL()  {
         return false;
     }
 
-    public boolean supportsIntegrityEnhancementFacility() throws SQLException {
+    public boolean supportsIntegrityEnhancementFacility()  {
         return false;
     }
 
-    public boolean supportsOuterJoins() throws SQLException {
+    public boolean supportsOuterJoins()  {
         return false;
     }
 
-    public boolean supportsFullOuterJoins() throws SQLException {
+    public boolean supportsFullOuterJoins()  {
         return false;
     }
 
-    public boolean supportsLimitedOuterJoins() throws SQLException {
+    public boolean supportsLimitedOuterJoins()  {
         return false;
     }
 
-    public String getSchemaTerm() throws SQLException {
+    public String getSchemaTerm()  {
         return null;
     }
 
-    public String getProcedureTerm() throws SQLException {
+    public String getProcedureTerm()  {
         return null;
     }
 
-    public String getCatalogTerm() throws SQLException {
+    public String getCatalogTerm()  {
         return null;
     }
 
-    public boolean isCatalogAtStart() throws SQLException {
+    public boolean isCatalogAtStart()  {
         return false;
     }
 
-    public String getCatalogSeparator() throws SQLException {
+    public String getCatalogSeparator()  {
         return null;
     }
 
-    public boolean supportsSchemasInDataManipulation() throws SQLException {
+    public boolean supportsSchemasInDataManipulation()  {
         return false;
     }
 
-    public boolean supportsSchemasInProcedureCalls() throws SQLException {
+    public boolean supportsSchemasInProcedureCalls()  {
         return false;
     }
 
-    public boolean supportsSchemasInTableDefinitions() throws SQLException {
+    public boolean supportsSchemasInTableDefinitions()  {
         return false;
     }
 
-    public boolean supportsSchemasInIndexDefinitions() throws SQLException {
+    public boolean supportsSchemasInIndexDefinitions()  {
         return false;
     }
 
-    public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException 
{
+    public boolean supportsSchemasInPrivilegeDefinitions()  {
         return false;
     }
 
-    public boolean supportsCatalogsInDataManipulation() throws SQLException {
+    public boolean supportsCatalogsInDataManipulation()  {
         return false;
     }
 
-    public boolean supportsCatalogsInProcedureCalls() throws SQLException {
+    public boolean supportsCatalogsInProcedureCalls()  {
         return false;
     }
 
-    public boolean supportsCatalogsInTableDefinitions() throws SQLException {
+    public boolean supportsCatalogsInTableDefinitions()  {
         return false;
     }
 
-    public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
+    public boolean supportsCatalogsInIndexDefinitions()  {
         return false;
     }
 
-    public boolean supportsCatalogsInPrivilegeDefinitions() throws 
SQLException {
+    public boolean supportsCatalogsInPrivilegeDefinitions()  {
         return false;
     }
 
-    public boolean supportsPositionedDelete() throws SQLException {
+    public boolean supportsPositionedDelete()  {
         return false;
     }
 
-    public boolean supportsPositionedUpdate() throws SQLException {
+    public boolean supportsPositionedUpdate()  {
         return false;
     }
 
-    public boolean supportsSelectForUpdate() throws SQLException {
+    public boolean supportsSelectForUpdate()  {
         return false;
     }
 
-    public boolean supportsStoredProcedures() throws SQLException {
+    public boolean supportsStoredProcedures()  {
         return false;
     }
 
-    public boolean supportsSubqueriesInComparisons() throws SQLException {
+    public boolean supportsSubqueriesInComparisons()  {
         return false;
     }
 
-    public boolean supportsSubqueriesInExists() throws SQLException {
+    public boolean supportsSubqueriesInExists()  {
         return false;
     }
 
-    public boolean supportsSubqueriesInIns() throws SQLException {
+    public boolean supportsSubqueriesInIns()  {
         return false;
     }
 
-    public boolean supportsSubqueriesInQuantifieds() throws SQLException {
+    public boolean supportsSubqueriesInQuantifieds()  {
         return false;
     }
 
-    public boolean supportsCorrelatedSubqueries() throws SQLException {
+    public boolean supportsCorrelatedSubqueries()  {
         return false;
     }
 
-    public boolean supportsUnion() throws SQLException {
+    public boolean supportsUnion()  {
         return false;
     }
 
-    public boolean supportsUnionAll() throws SQLException {
+    public boolean supportsUnionAll()  {
         return false;
     }
 
-    public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
+    public boolean supportsOpenCursorsAcrossCommit()  {
         return false;
     }
 
-    public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
+    public boolean supportsOpenCursorsAcrossRollback()  {
         return false;
     }
 
-    public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
+    public boolean supportsOpenStatementsAcrossCommit()  {
         return false;
     }
 
-    public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
+    public boolean supportsOpenStatementsAcrossRollback()  {
         return false;
     }
 
-    public int getMaxBinaryLiteralLength() throws SQLException {
+    public int getMaxBinaryLiteralLength()  {
         return 0;
     }
 
-    public int getMaxCharLiteralLength() throws SQLException {
+    public int getMaxCharLiteralLength()  {
         return 0;
     }
 
-    public int getMaxColumnNameLength() throws SQLException {
+    public int getMaxColumnNameLength()  {
         return 0;
     }
 
-    public int getMaxColumnsInGroupBy() throws SQLException {
+    public int getMaxColumnsInGroupBy()  {
         return 0;
     }
 
-    public int getMaxColumnsInIndex() throws SQLException {
+    public int getMaxColumnsInIndex()  {
         return 0;
     }
 
-    public int getMaxColumnsInOrderBy() throws SQLException {
+    public int getMaxColumnsInOrderBy()  {
         return 0;
     }
 
-    public int getMaxColumnsInSelect() throws SQLException {
+    public int getMaxColumnsInSelect()  {
         return 0;
     }
 
-    public int getMaxColumnsInTable() throws SQLException {
+    public int getMaxColumnsInTable()  {
         return 0;
     }
 
-    public int getMaxConnections() throws SQLException {
+    public int getMaxConnections()  {
         return 0;
     }
 
-    public int getMaxCursorNameLength() throws SQLException {
+    public int getMaxCursorNameLength()  {
         return 0;
     }
 
-    public int getMaxIndexLength() throws SQLException {
+    public int getMaxIndexLength()  {
         return 0;
     }
 
-    public int getMaxSchemaNameLength() throws SQLException {
+    public int getMaxSchemaNameLength()  {
         return 0;
     }
 
-    public int getMaxProcedureNameLength() throws SQLException {
+    public int getMaxProcedureNameLength()  {
         return 0;
     }
 
-    public int getMaxCatalogNameLength() throws SQLException {
+    public int getMaxCatalogNameLength()  {
         return 0;
     }
 
-    public int getMaxRowSize() throws SQLException {
+    public int getMaxRowSize()  {
         return 0;
     }
 
-    public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
+    public boolean doesMaxRowSizeIncludeBlobs()  {
         return false;
     }
 
-    public int getMaxStatementLength() throws SQLException {
+    public int getMaxStatementLength()  {
         return 0;
     }
 
-    public int getMaxStatements() throws SQLException {
+    public int getMaxStatements()  {
         return 0;
     }
 
-    public int getMaxTableNameLength() throws SQLException {
+    public int getMaxTableNameLength()  {
         return 0;
     }
 
-    public int getMaxTablesInSelect() throws SQLException {
+    public int getMaxTablesInSelect()  {
         return 0;
     }
 
-    public int getMaxUserNameLength() throws SQLException {
+    public int getMaxUserNameLength()  {
         return 0;
     }
 
-    public int getDefaultTransactionIsolation() throws SQLException {
+    public int getDefaultTransactionIsolation()  {
         return 0;
     }
 
-    public boolean supportsTransactions() throws SQLException {
+    public boolean supportsTransactions()  {
         return false;
     }
 
-    public boolean supportsTransactionIsolationLevel(int level) throws 
SQLException {
+    public boolean supportsTransactionIsolationLevel(int level)  {
         return false;
     }
 
-    public boolean supportsDataDefinitionAndDataManipulationTransactions() 
throws SQLException {
+    public boolean supportsDataDefinitionAndDataManipulationTransactions()  {
         return false;
     }
 
-    public boolean supportsDataManipulationTransactionsOnly() throws 
SQLException {
+    public boolean supportsDataManipulationTransactionsOnly()  {
         return false;
     }
 
-    public boolean dataDefinitionCausesTransactionCommit() throws SQLException 
{
+    public boolean dataDefinitionCausesTransactionCommit()  {
         return false;
     }
 
-    public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
+    public boolean dataDefinitionIgnoredInTransactions()  {
         return false;
     }
 
     public ResultSet getProcedures(String catalog, String schemaPattern, 
String procedureNamePattern)
-            throws SQLException {
+             {
         return null;
     }
 
     public ResultSet getProcedureColumns(
             String catalog, String schemaPattern, String procedureNamePattern, 
String columnNamePattern)
-            throws SQLException {
+             {
         return null;
     }
 
     public ResultSet getTables(String catalog, String schemaPattern, String 
tableNamePattern, String[] types)
-            throws SQLException {
+             {
         return null;
     }
 
-    public ResultSet getSchemas() throws SQLException {
+    public ResultSet getSchemas()  {
         return null;
     }
 
-    public ResultSet getCatalogs() throws SQLException {
+    public ResultSet getCatalogs()  {
         return null;
     }
 
-    public ResultSet getTableTypes() throws SQLException {
+    public ResultSet getTableTypes()  {
         return null;
     }
 
     public ResultSet getColumns(String catalog, String schemaPattern, String 
tableNamePattern, String columnNamePattern)
-            throws SQLException {
+             {
         return null;
     }
 
     public ResultSet getColumnPrivileges(String catalog, String schema, String 
table, String columnNamePattern)
-            throws SQLException {
+             {
         return null;
     }
 
     public ResultSet getTablePrivileges(String catalog, String schemaPattern, 
String tableNamePattern)
-            throws SQLException {
+             {
         return null;
     }
 
     public ResultSet getBestRowIdentifier(String catalog, String schema, 
String table, int scope, boolean nullable)
-            throws SQLException {
+             {
         return null;
     }
 
-    public ResultSet getVersionColumns(String catalog, String schema, String 
table) throws SQLException {
+    public ResultSet getVersionColumns(String catalog, String schema, String 
table)  {
         return null;
     }
 
-    public ResultSet getPrimaryKeys(String catalog, String schema, String 
table) throws SQLException {
+    public ResultSet getPrimaryKeys(String catalog, String schema, String 
table)  {
         return null;
     }
 
-    public ResultSet getImportedKeys(String catalog, String schema, String 
table) throws SQLException {
+    public ResultSet getImportedKeys(String catalog, String schema, String 
table)  {
         return null;
     }
 
-    public ResultSet getExportedKeys(String catalog, String schema, String 
table) throws SQLException {
+    public ResultSet getExportedKeys(String catalog, String schema, String 
table)  {
         return null;
     }
 
@@ -559,188 +559,188 @@ public class HibernateConnectionMetadata implements 
DatabaseMetaData {
             String foreignCatalog,
             String foreignSchema,
             String foreignTable)
-            throws SQLException {
+             {
         return null;
     }
 
-    public ResultSet getTypeInfo() throws SQLException {
+    public ResultSet getTypeInfo()  {
         return null;
     }
 
     public ResultSet getIndexInfo(String catalog, String schema, String table, 
boolean unique, boolean approximate)
-            throws SQLException {
+             {
         return null;
     }
 
-    public boolean supportsResultSetType(int type) throws SQLException {
+    public boolean supportsResultSetType(int type)  {
         return false;
     }
 
-    public boolean supportsResultSetConcurrency(int type, int concurrency) 
throws SQLException {
+    public boolean supportsResultSetConcurrency(int type, int concurrency)  {
         return false;
     }
 
-    public boolean ownUpdatesAreVisible(int type) throws SQLException {
+    public boolean ownUpdatesAreVisible(int type)  {
         return false;
     }
 
-    public boolean ownDeletesAreVisible(int type) throws SQLException {
+    public boolean ownDeletesAreVisible(int type)  {
         return false;
     }
 
-    public boolean ownInsertsAreVisible(int type) throws SQLException {
+    public boolean ownInsertsAreVisible(int type)  {
         return false;
     }
 
-    public boolean othersUpdatesAreVisible(int type) throws SQLException {
+    public boolean othersUpdatesAreVisible(int type)  {
         return false;
     }
 
-    public boolean othersDeletesAreVisible(int type) throws SQLException {
+    public boolean othersDeletesAreVisible(int type)  {
         return false;
     }
 
-    public boolean othersInsertsAreVisible(int type) throws SQLException {
+    public boolean othersInsertsAreVisible(int type)  {
         return false;
     }
 
-    public boolean updatesAreDetected(int type) throws SQLException {
+    public boolean updatesAreDetected(int type)  {
         return false;
     }
 
-    public boolean deletesAreDetected(int type) throws SQLException {
+    public boolean deletesAreDetected(int type)  {
         return false;
     }
 
-    public boolean insertsAreDetected(int type) throws SQLException {
+    public boolean insertsAreDetected(int type)  {
         return false;
     }
 
-    public boolean supportsBatchUpdates() throws SQLException {
+    public boolean supportsBatchUpdates()  {
         return false;
     }
 
     public ResultSet getUDTs(String catalog, String schemaPattern, String 
typeNamePattern, int[] types)
-            throws SQLException {
+             {
         return null;
     }
 
-    public Connection getConnection() throws SQLException {
+    public Connection getConnection()  {
         return null;
     }
 
-    public boolean supportsSavepoints() throws SQLException {
+    public boolean supportsSavepoints()  {
         return false;
     }
 
-    public boolean supportsNamedParameters() throws SQLException {
+    public boolean supportsNamedParameters()  {
         return false;
     }
 
-    public boolean supportsMultipleOpenResults() throws SQLException {
+    public boolean supportsMultipleOpenResults()  {
         return false;
     }
 
-    public boolean supportsGetGeneratedKeys() throws SQLException {
+    public boolean supportsGetGeneratedKeys()  {
         return false;
     }
 
-    public ResultSet getSuperTypes(String catalog, String schemaPattern, 
String typeNamePattern) throws SQLException {
+    public ResultSet getSuperTypes(String catalog, String schemaPattern, 
String typeNamePattern)  {
         return null;
     }
 
-    public ResultSet getSuperTables(String catalog, String schemaPattern, 
String tableNamePattern) throws SQLException {
+    public ResultSet getSuperTables(String catalog, String schemaPattern, 
String tableNamePattern)  {
         return null;
     }
 
     public ResultSet getAttributes(
             String catalog, String schemaPattern, String typeNamePattern, 
String attributeNamePattern)
-            throws SQLException {
+             {
         return null;
     }
 
-    public boolean supportsResultSetHoldability(int holdability) throws 
SQLException {
+    public boolean supportsResultSetHoldability(int holdability)  {
         return false;
     }
 
-    public int getResultSetHoldability() throws SQLException {
+    public int getResultSetHoldability()  {
         return 0;
     }
 
-    public int getDatabaseMajorVersion() throws SQLException {
+    public int getDatabaseMajorVersion()  {
         return 0;
     }
 
-    public int getDatabaseMinorVersion() throws SQLException {
+    public int getDatabaseMinorVersion()  {
         return 0;
     }
 
-    public int getJDBCMajorVersion() throws SQLException {
+    public int getJDBCMajorVersion()  {
         return 0;
     }
 
-    public int getJDBCMinorVersion() throws SQLException {
+    public int getJDBCMinorVersion()  {
         return 0;
     }
 
-    public int getSQLStateType() throws SQLException {
+    public int getSQLStateType()  {
         return 0;
     }
 
-    public boolean locatorsUpdateCopy() throws SQLException {
+    public boolean locatorsUpdateCopy()  {
         return false;
     }
 
-    public boolean supportsStatementPooling() throws SQLException {
+    public boolean supportsStatementPooling()  {
         return false;
     }
 
-    public RowIdLifetime getRowIdLifetime() throws SQLException {
+    public RowIdLifetime getRowIdLifetime()  {
         return null;
     }
 
-    public ResultSet getSchemas(String catalog, String schemaPattern) throws 
SQLException {
+    public ResultSet getSchemas(String catalog, String schemaPattern)  {
         return null;
     }
 
-    public boolean supportsStoredFunctionsUsingCallSyntax() throws 
SQLException {
+    public boolean supportsStoredFunctionsUsingCallSyntax()  {
         return false;
     }
 
-    public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
+    public boolean autoCommitFailureClosesAllResultSets()  {
         return false;
     }
 
-    public ResultSet getClientInfoProperties() throws SQLException {
+    public ResultSet getClientInfoProperties()  {
         return null;
     }
 
     public ResultSet getFunctions(String catalog, String schemaPattern, String 
functionNamePattern)
-            throws SQLException {
+             {
         return null;
     }
 
     public ResultSet getFunctionColumns(
             String catalog, String schemaPattern, String functionNamePattern, 
String columnNamePattern)
-            throws SQLException {
+             {
         return null;
     }
 
-    public <T> T unwrap(Class<T> iface) throws SQLException {
+    public <T> T unwrap(Class<T> iface)  {
         return null;
     }
 
-    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+    public boolean isWrapperFor(Class<?> iface)  {
         return false;
     }
 
     // @Override only override for java 1.7
-    public boolean generatedKeyAlwaysReturned() throws SQLException {
+    public boolean generatedKeyAlwaysReturned()  {
         return false;
     }
 
     // @Override only override for java 1.7
-    public ResultSet getPseudoColumns(String arg0, String arg1, String arg2, 
String arg3) throws SQLException {
+    public ResultSet getPseudoColumns(String arg0, String arg1, String arg2, 
String arg3)  {
         return null;
     }
 }
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateDriver.java
 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateDriver.java
index c9b5899360..101573945b 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateDriver.java
+++ 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateDriver.java
@@ -15,15 +15,15 @@ public class HibernateDriver implements Driver, 
LiquibaseExtDriver {
 
     private ResourceAccessor resourceAccessor;
 
-    public Connection connect(String url, Properties info) throws SQLException 
{
+    public Connection connect(String url, Properties info)  {
         return new HibernateConnection(url, resourceAccessor);
     }
 
-    public boolean acceptsURL(String url) throws SQLException {
+    public boolean acceptsURL(String url)  {
         return url.startsWith("hibernate:");
     }
 
-    public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) 
throws SQLException {
+    public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)  {
         return new DriverPropertyInfo[0];
     }
 
diff --git 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/ColumnSnapshotGenerator.java
 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/ColumnSnapshotGenerator.java
index f6786cedcb..fbed4db46c 100644
--- 
a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/ColumnSnapshotGenerator.java
+++ 
b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/ColumnSnapshotGenerator.java
@@ -151,7 +151,7 @@ public class ColumnSnapshotGenerator extends 
HibernateSnapshotGenerator {
                 if (hibernatePrimaryKey != null) {
                     boolean isPrimaryKeyColumn = false;
                     for (org.hibernate.mapping.Column pkColumn :
-                            (List<org.hibernate.mapping.Column>) 
hibernatePrimaryKey.getColumns()) {
+                            hibernatePrimaryKey.getColumns()) {
                         if 
(pkColumn.getName().equalsIgnoreCase(hibernateColumn.getName())) {
                             isPrimaryKeyColumn = true;
                             break;
diff --git 
a/grails-data-hibernate7/dbmigration/src/test/groovy/org/grails/plugins/databasemigration/DatabaseMigrationGrailsPluginSpec.groovy
 
b/grails-data-hibernate7/dbmigration/src/test/groovy/org/grails/plugins/databasemigration/DatabaseMigrationGrailsPluginSpec.groovy
new file mode 100644
index 0000000000..656965b30c
--- /dev/null
+++ 
b/grails-data-hibernate7/dbmigration/src/test/groovy/org/grails/plugins/databasemigration/DatabaseMigrationGrailsPluginSpec.groovy
@@ -0,0 +1,167 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.grails.plugins.databasemigration
+
+import grails.core.GrailsApplication
+import grails.spring.BeanBuilder
+import liquibase.parser.ChangeLogParserFactory
+import org.grails.config.PropertySourcesConfig
+import org.grails.plugins.databasemigration.liquibase.GrailsLiquibase
+import org.grails.plugins.databasemigration.liquibase.GrailsLiquibaseFactory
+import org.grails.plugins.databasemigration.liquibase.GroovyChangeLogParser
+import org.springframework.context.ApplicationContext
+import org.springframework.context.ConfigurableApplicationContext
+import org.springframework.transaction.PlatformTransactionManager
+import spock.lang.Specification
+import spock.lang.Unroll
+
+import javax.sql.DataSource
+
+class DatabaseMigrationGrailsPluginSpec extends Specification {
+
+    void "test doWithSpring registers beans"() {
+        given:
+        DatabaseMigrationGrailsPlugin plugin = new 
DatabaseMigrationGrailsPlugin()
+        GrailsApplication application = Mock(GrailsApplication)
+        ApplicationContext applicationContext = Mock(ApplicationContext)
+        application.getConfig() >> new PropertySourcesConfig()
+        
+        plugin.setGrailsApplication(application)
+        plugin.setApplicationContext(applicationContext)
+
+        // Ensure GroovyChangeLogParser is in the factory for 
configureLiquibase()
+        if (!ChangeLogParserFactory.instance.parsers.find { it instanceof 
GroovyChangeLogParser }) {
+            ChangeLogParserFactory.instance.register(new 
GroovyChangeLogParser())
+        }
+
+        when:
+        BeanBuilder bb = new BeanBuilder()
+        bb.beans plugin.doWithSpring()
+        ApplicationContext ctx = bb.createApplicationContext()
+
+        then:
+        ctx.containsBean('grailsLiquibaseFactory')
+        ctx.getBean('grailsLiquibaseFactory') instanceof GrailsLiquibase
+    }
+
+    @Unroll
+    void "test getDataSourceNames with config: #configMap"() {
+        given:
+        DatabaseMigrationGrailsPlugin plugin = new 
DatabaseMigrationGrailsPlugin()
+        GrailsApplication application = Mock(GrailsApplication)
+        application.getConfig() >> new PropertySourcesConfig(configMap)
+        plugin.setGrailsApplication(application)
+
+        expect:
+        plugin.getDataSourceNames() as Set == expectedNames as Set
+
+        where:
+        configMap                               | expectedNames
+        [:]                                     | ['dataSource']
+        [dataSources: [other: [:]]]             | ['dataSource', 'other']
+        [dataSources: [dataSource: [:]]]        | ['dataSource']
+        [dataSources: [ds1: [:], ds2: [:]]]     | ['dataSource', 'ds1', 'ds2']
+    }
+
+    @Unroll
+    void "test getDataSourceName for #input is #expected"() {
+        expect:
+        DatabaseMigrationGrailsPlugin.getDataSourceName(input) == expected
+
+        where:
+        input           | expected
+        null            | null
+        ''              | ''
+        'dataSource'    | 'dataSource'
+        'other'         | 'dataSource_other'
+    }
+
+    @Unroll
+    void "test isDefaultDataSource for #input is #expected"() {
+        expect:
+        DatabaseMigrationGrailsPlugin.isDefaultDataSource(input) == expected
+
+        where:
+        input           | expected
+        null            | true
+        ''              | true
+        'dataSource'    | true
+        'other'         | false
+    }
+
+    void "test doWithApplicationContext skip when no updateOnStart"() {
+        given:
+        DatabaseMigrationGrailsPlugin plugin = new 
DatabaseMigrationGrailsPlugin()
+        GrailsApplication application = Mock(GrailsApplication)
+        ApplicationContext applicationContext = Mock(ApplicationContext)
+        
+        // Config with updateOnStart = false
+        application.getConfig() >> new PropertySourcesConfig([
+            'grails.plugin.databasemigration.updateOnStart': false
+        ])
+        
+        plugin.setGrailsApplication(application)
+        plugin.setApplicationContext(applicationContext)
+
+        when:
+        plugin.doWithApplicationContext()
+
+        then:
+        0 * applicationContext.getBean('grailsLiquibaseFactory', 
GrailsLiquibase)
+    }
+
+    void "test doWithApplicationContext triggers update when updateOnStart is 
true"() {
+        given:
+        DatabaseMigrationGrailsPlugin plugin = new 
DatabaseMigrationGrailsPlugin()
+        GrailsApplication application = Mock(GrailsApplication)
+        ConfigurableApplicationContext applicationContext = 
Mock(ConfigurableApplicationContext)
+        
+        application.getConfig() >> new PropertySourcesConfig([
+            'grails.plugin.databasemigration.updateOnStart': true,
+            'grails.plugin.databasemigration.updateOnStartFileName': 
'test-changelog.groovy'
+        ])
+        
+        plugin.setGrailsApplication(application)
+        plugin.setApplicationContext(applicationContext)
+
+        DataSource dataSource = Mock(DataSource)
+        PlatformTransactionManager transactionManager = 
Mock(PlatformTransactionManager)
+        GrailsLiquibase grailsLiquibase = Mock(GrailsLiquibase)
+
+        applicationContext.getBean('dataSource', DataSource) >> dataSource
+        applicationContext.getBean('transactionManager', 
PlatformTransactionManager) >> transactionManager
+        applicationContext.getBean('&grailsLiquibaseFactory') >> 
Mock(GrailsLiquibaseFactory)
+        applicationContext.getBean('grailsLiquibaseFactory', GrailsLiquibase) 
>> grailsLiquibase
+
+        // Mock PlatformTransactionManager and TransactionStatus
+        org.springframework.transaction.TransactionStatus transactionStatus = 
Mock(org.springframework.transaction.TransactionStatus)
+        transactionManager.getTransaction(_ as 
org.springframework.transaction.TransactionDefinition) >> transactionStatus
+
+        // DatabaseMigrationTransactionManager uses 
applicationContext.getBean(beanName, PlatformTransactionManager)
+        // Ensure ALL calls to getBean with any string and 
PlatformTransactionManager are handled
+        applicationContext.getBean(_ as String, PlatformTransactionManager) >> 
transactionManager
+
+        when:
+        plugin.doWithApplicationContext()
+
+        then:
+        1 * grailsLiquibase.setChangeLog('test-changelog.groovy')
+        1 * grailsLiquibase.afterPropertiesSet()
+    }
+}

Reply via email to