HHH-16223 Deprecate HBM2DDL_SCRIPTS_CREATE_TARGET

This commit is contained in:
Sanne Grinovero 2023-03-07 15:08:38 +00:00
parent 39f05629fc
commit f9c0761268
12 changed files with 17 additions and 24 deletions

View File

@ -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";
/**

View File

@ -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" );

View File

@ -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(

View File

@ -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 );

View File

@ -91,7 +91,7 @@ public class JpaSchemaGeneratorTest extends EntityManagerFactoryBasedFunctionalT
Map<Object, Object> 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<Object, Object> 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 );
}

View File

@ -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<Object, Object> 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<Class> classes = new ArrayList<Class>();

View File

@ -108,7 +108,7 @@ public class SchemaScriptFileGenerationTest {
private Map getConfig() {
final Map<Object, Object> 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<Class> classes = new ArrayList<Class>();

View File

@ -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

View File

@ -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 );
}

View File

@ -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

View File

@ -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 );

View File

@ -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" );