From f9c0761268f92c2bae936b1e63651604a2af26be Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Tue, 7 Mar 2023 15:08:38 +0000 Subject: [PATCH] HHH-16223 Deprecate HBM2DDL_SCRIPTS_CREATE_TARGET --- .../java/org/hibernate/cfg/AvailableSettings.java | 15 ++++----------- .../onetoone/OneToOneJoinTableUniquenessTest.java | 2 +- .../DefaultCatalogAndSchemaTest.java | 2 +- ...PostgreSQLSequenceGeneratorWithSerialTest.java | 2 +- .../jpa/schemagen/JpaSchemaGeneratorTest.java | 4 ++-- ...eateDropUtf8WithoutHbm2DdlCharsetNameTest.java | 4 ++-- .../schemagen/SchemaScriptFileGenerationTest.java | 2 +- ...NASchemaMigrationTargetScriptCreationTest.java | 2 +- .../SchemaCreationToOutputScriptTest.java | 2 +- .../SchemaMigrationTargetScriptCreationTest.java | 2 +- .../SchemaMigrationToOutputScriptTest.java | 2 +- .../tools/OrderSequenceGenerationTest.java | 2 +- 12 files changed, 17 insertions(+), 24 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java index f7c76d2e93..9f03c9be91 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java @@ -1659,22 +1659,15 @@ public interface AvailableSettings { String HBM2DDL_CREATE_SCRIPT_SOURCE = "javax.persistence.schema-generation.create-script-source"; /** - * Specifies the DROP script file as either a {@link java.io.Reader} configured for reading - * the DDL script file or a string designating a file {@link java.net.URL} for the DDL script. - * - * @see #HBM2DDL_DROP_SOURCE + * @deprecated Migrate to {@link #JAKARTA_HBM2DDL_DROP_SCRIPT_SOURCE} */ + @Deprecated String HBM2DDL_DROP_SCRIPT_SOURCE = "javax.persistence.schema-generation.drop-script-source"; /** - * For cases where the {@value #HBM2DDL_SCRIPTS_ACTION} value indicates that schema creation - * commands should be written to DDL script file, {@value #HBM2DDL_SCRIPTS_CREATE_TARGET} - * specifies either a {@link java.io.Writer} configured for output of the DDL script or a - * string specifying the file URL for the DDL script. - * - * @see #HBM2DDL_SCRIPTS_ACTION + * @deprecated Migrate to {@link #JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET} */ - @SuppressWarnings("JavaDoc") + @Deprecated String HBM2DDL_SCRIPTS_CREATE_TARGET = "javax.persistence.schema-generation.scripts.create-target"; /** diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetoone/OneToOneJoinTableUniquenessTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetoone/OneToOneJoinTableUniquenessTest.java index 2db37c739a..d6f5246dfb 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetoone/OneToOneJoinTableUniquenessTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetoone/OneToOneJoinTableUniquenessTest.java @@ -60,7 +60,7 @@ public class OneToOneJoinTableUniquenessTest extends BaseCoreFunctionalTestCase fail( e.getMessage() ); } String value = output.toPath().toString(); - configuration.setProperty( AvailableSettings.HBM2DDL_SCRIPTS_CREATE_TARGET, value ); + configuration.setProperty( AvailableSettings.JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET, value ); configuration.setProperty( AvailableSettings.HBM2DDL_SCRIPTS_ACTION, "create" ); configuration.setProperty( AvailableSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, "create-drop" ); configuration.setProperty( AvailableSettings.FORMAT_SQL, "false" ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/boot/database/qualfiedTableNaming/DefaultCatalogAndSchemaTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/boot/database/qualfiedTableNaming/DefaultCatalogAndSchemaTest.java index 52c125d1c4..71cc2b8fb5 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/boot/database/qualfiedTableNaming/DefaultCatalogAndSchemaTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/boot/database/qualfiedTableNaming/DefaultCatalogAndSchemaTest.java @@ -689,7 +689,7 @@ public class DefaultCatalogAndSchemaTest { ); StringWriter writer = new StringWriter(); settings.put( AvailableSettings.HBM2DDL_SCRIPTS_ACTION, action ); - settings.put( AvailableSettings.HBM2DDL_SCRIPTS_CREATE_TARGET, writer ); + settings.put( AvailableSettings.JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET, writer ); settings.put( AvailableSettings.HBM2DDL_SCRIPTS_DROP_TARGET, writer ); SchemaManagementToolCoordinator.process( diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/id/hhh12973/PostgreSQLSequenceGeneratorWithSerialTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/id/hhh12973/PostgreSQLSequenceGeneratorWithSerialTest.java index 32fc70e01f..fe43bf2337 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/id/hhh12973/PostgreSQLSequenceGeneratorWithSerialTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/id/hhh12973/PostgreSQLSequenceGeneratorWithSerialTest.java @@ -101,7 +101,7 @@ public class PostgreSQLSequenceGeneratorWithSerialTest extends EntityManagerFact ssr.close(); } - settings.put( AvailableSettings.HBM2DDL_DROP_SCRIPT_SOURCE, new StringReader( + settings.put( AvailableSettings.JAKARTA_HBM2DDL_DROP_SCRIPT_SOURCE, new StringReader( DROP_TABLE + ";" + DROP_SEQUENCE ) ); settings.put( AvailableSettings.SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGY, SequenceMismatchStrategy.FIX ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/JpaSchemaGeneratorTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/JpaSchemaGeneratorTest.java index bee262f96f..2e6fa69916 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/JpaSchemaGeneratorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/JpaSchemaGeneratorTest.java @@ -91,7 +91,7 @@ public class JpaSchemaGeneratorTest extends EntityManagerFactoryBasedFunctionalT Map settings = buildSettings(); settings.put( AvailableSettings.JAKARTA_HBM2DDL_DROP_SOURCE, "metadata-then-script" ); settings.put( AvailableSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, "drop" ); - settings.put( AvailableSettings.HBM2DDL_DROP_SCRIPT_SOURCE, getDropSqlScript() ); + settings.put( AvailableSettings.JAKARTA_HBM2DDL_DROP_SCRIPT_SOURCE, getDropSqlScript() ); doTest( settings ); } @@ -101,7 +101,7 @@ public class JpaSchemaGeneratorTest extends EntityManagerFactoryBasedFunctionalT Map settings = buildSettings(); settings.put( AvailableSettings.JAKARTA_HBM2DDL_DROP_SOURCE, "metadata-then-script" ); settings.put( AvailableSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, "drop" ); - settings.put( AvailableSettings.HBM2DDL_DROP_SCRIPT_SOURCE, getResourceUrlString( getDropSqlScript() ) ); + settings.put( AvailableSettings.JAKARTA_HBM2DDL_DROP_SCRIPT_SOURCE, getResourceUrlString( getDropSqlScript() ) ); doTest( settings ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaCreateDropUtf8WithoutHbm2DdlCharsetNameTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaCreateDropUtf8WithoutHbm2DdlCharsetNameTest.java index 7b9449822d..86485569e5 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaCreateDropUtf8WithoutHbm2DdlCharsetNameTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaCreateDropUtf8WithoutHbm2DdlCharsetNameTest.java @@ -29,8 +29,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.hibernate.cfg.AvailableSettings.HBM2DDL_SCRIPTS_ACTION; -import static org.hibernate.cfg.AvailableSettings.HBM2DDL_SCRIPTS_CREATE_TARGET; import static org.hibernate.cfg.AvailableSettings.HBM2DDL_SCRIPTS_DROP_TARGET; +import static org.hibernate.cfg.AvailableSettings.JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET; import static org.junit.jupiter.api.Assertions.assertTrue; /** @@ -45,7 +45,7 @@ public class SchemaCreateDropUtf8WithoutHbm2DdlCharsetNameTest { protected Map getConfig() { final Map config = Environment.getProperties(); - config.put( HBM2DDL_SCRIPTS_CREATE_TARGET, createSchema.toPath() ); + config.put( JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET, createSchema.toPath() ); config.put( HBM2DDL_SCRIPTS_DROP_TARGET, dropSchema.toPath() ); config.put( HBM2DDL_SCRIPTS_ACTION, "drop-and-create" ); ArrayList classes = new ArrayList(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaScriptFileGenerationTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaScriptFileGenerationTest.java index e2e6212f61..0f31860086 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaScriptFileGenerationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/schemagen/SchemaScriptFileGenerationTest.java @@ -108,7 +108,7 @@ public class SchemaScriptFileGenerationTest { private Map getConfig() { final Map config = Environment.getProperties(); - config.put( AvailableSettings.HBM2DDL_SCRIPTS_CREATE_TARGET, createSchema.toPath() ); + config.put( AvailableSettings.JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET, createSchema.toPath() ); config.put( AvailableSettings.HBM2DDL_SCRIPTS_DROP_TARGET, dropSchema.toPath() ); config.put( AvailableSettings.HBM2DDL_SCRIPTS_ACTION, "drop-and-create" ); ArrayList classes = new ArrayList(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/HANASchemaMigrationTargetScriptCreationTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/HANASchemaMigrationTargetScriptCreationTest.java index 59ff64586e..cf8e35bbb2 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/HANASchemaMigrationTargetScriptCreationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/HANASchemaMigrationTargetScriptCreationTest.java @@ -68,7 +68,7 @@ public class HANASchemaMigrationTargetScriptCreationTest extends BaseCoreFunctio } this.output.deleteOnExit(); configuration.setProperty( Environment.HBM2DDL_SCRIPTS_ACTION, "create" ); - configuration.setProperty( Environment.HBM2DDL_SCRIPTS_CREATE_TARGET, this.output.getAbsolutePath() ); + configuration.setProperty( Environment.JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET, this.output.getAbsolutePath() ); } @Override diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/SchemaCreationToOutputScriptTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/SchemaCreationToOutputScriptTest.java index be1c5499c2..cdcb6aac6b 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/SchemaCreationToOutputScriptTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/SchemaCreationToOutputScriptTest.java @@ -80,7 +80,7 @@ public class SchemaCreationToOutputScriptTest { final StandardServiceRegistryBuilder standardServiceRegistryBuilder = new StandardServiceRegistryBuilder() .applySetting( Environment.FORMAT_SQL, "false" ) .applySetting( Environment.HBM2DDL_SCRIPTS_ACTION, "create" ) - .applySetting( AvailableSettings.HBM2DDL_SCRIPTS_CREATE_TARGET, output.getAbsolutePath() ); + .applySetting( AvailableSettings.JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET, output.getAbsolutePath() ); if ( append != null ) { standardServiceRegistryBuilder.applySetting( AvailableSettings.HBM2DDL_SCRIPTS_CREATE_APPEND, append ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/SchemaMigrationTargetScriptCreationTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/SchemaMigrationTargetScriptCreationTest.java index d9bfaf854b..86ce432a5d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/SchemaMigrationTargetScriptCreationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/SchemaMigrationTargetScriptCreationTest.java @@ -62,7 +62,7 @@ public class SchemaMigrationTargetScriptCreationTest extends BaseCoreFunctionalT output.deleteOnExit(); configuration.setProperty( Environment.JAKARTA_HBM2DDL_DATABASE_ACTION, "update" ); configuration.setProperty( Environment.HBM2DDL_SCRIPTS_ACTION, "update" ); - configuration.setProperty( Environment.HBM2DDL_SCRIPTS_CREATE_TARGET, output.getAbsolutePath() ); + configuration.setProperty( Environment.JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET, output.getAbsolutePath() ); } @After diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/SchemaMigrationToOutputScriptTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/SchemaMigrationToOutputScriptTest.java index 9063fd33eb..6d1aa9d0a1 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/SchemaMigrationToOutputScriptTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/schemaupdate/SchemaMigrationToOutputScriptTest.java @@ -92,7 +92,7 @@ public class SchemaMigrationToOutputScriptTest { final StandardServiceRegistryBuilder standardServiceRegistryBuilder = new StandardServiceRegistryBuilder() .applySetting( Environment.FORMAT_SQL, "false" ) .applySetting( Environment.HBM2DDL_SCRIPTS_ACTION, "update" ) - .applySetting( AvailableSettings.HBM2DDL_SCRIPTS_CREATE_TARGET, output.getAbsolutePath() ); + .applySetting( AvailableSettings.JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET, output.getAbsolutePath() ); if ( append != null ) { standardServiceRegistryBuilder.applySetting( AvailableSettings.HBM2DDL_SCRIPTS_CREATE_APPEND, append ); diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/tools/OrderSequenceGenerationTest.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/tools/OrderSequenceGenerationTest.java index d2fbac3bfd..8b33301a9d 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/tools/OrderSequenceGenerationTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/tools/OrderSequenceGenerationTest.java @@ -54,7 +54,7 @@ public class OrderSequenceGenerationTest extends BaseEnversJPAFunctionalTestCase @Override protected void addConfigOptions(Map options) { super.addConfigOptions( options ); - options.put( AvailableSettings.HBM2DDL_SCRIPTS_CREATE_TARGET, createSchema.toPath() ); + options.put( AvailableSettings.JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET, createSchema.toPath() ); options.put( AvailableSettings.HBM2DDL_SCRIPTS_DROP_TARGET, dropSchema.toPath() ); options.put( AvailableSettings.HBM2DDL_SCRIPTS_ACTION, "drop-and-create" ); options.put( AvailableSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, "create-drop" );