diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/AbstractSchemaMigrator.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/AbstractSchemaMigrator.java index 6bdb4af198..49d9b9e29c 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/AbstractSchemaMigrator.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/AbstractSchemaMigrator.java @@ -519,9 +519,10 @@ public abstract class AbstractSchemaMigrator implements SchemaMigrator { ExecutionOptions options, GenerationTarget... targets) { if ( !StringHelper.isEmpty( sqlString ) ) { + String sqlStringFormatted = formatter.format( sqlString ); for ( GenerationTarget target : targets ) { try { - target.accept( formatter.format( sqlString ) ); + target.accept( sqlStringFormatted ); } catch (CommandAcceptanceException e) { if ( !quiet ) { diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/SchemaCreatorImpl.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/SchemaCreatorImpl.java index 3963bc0c76..0de5e13f60 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/SchemaCreatorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/SchemaCreatorImpl.java @@ -435,8 +435,9 @@ public class SchemaCreatorImpl implements SchemaCreator { } try { + String sqlStringFormatted = formatter.format( sqlString ); for ( GenerationTarget target : targets ) { - target.accept( formatter.format( sqlString ) ); + target.accept( sqlStringFormatted ); } } catch (CommandAcceptanceException e) { diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/SchemaDropperImpl.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/SchemaDropperImpl.java index d89f2c057d..66395c39d1 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/SchemaDropperImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/SchemaDropperImpl.java @@ -369,9 +369,10 @@ public class SchemaDropperImpl implements SchemaDropper { return; } + String sqlStringFormatted = formatter.format( sqlString ); for ( GenerationTarget target : targets ) { try { - target.accept( formatter.format( sqlString ) ); + target.accept( sqlStringFormatted ); } catch (CommandAcceptanceException e) { options.getExceptionHandler().handleException( e );