mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-10 05:04:52 +00:00
HHH-16223 Deprecate HBM2DDL_SCRIPTS_CREATE_TARGET
This commit is contained in:
parent
2e6158622f
commit
a15eb53f6f
@ -1659,22 +1659,15 @@ public interface AvailableSettings {
|
|||||||
String HBM2DDL_CREATE_SCRIPT_SOURCE = "javax.persistence.schema-generation.create-script-source";
|
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
|
* @deprecated Migrate to {@link #JAKARTA_HBM2DDL_DROP_SCRIPT_SOURCE}
|
||||||
* the DDL script file or a string designating a file {@link java.net.URL} for the DDL script.
|
|
||||||
*
|
|
||||||
* @see #HBM2DDL_DROP_SOURCE
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
String HBM2DDL_DROP_SCRIPT_SOURCE = "javax.persistence.schema-generation.drop-script-source";
|
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
|
* @deprecated Migrate to {@link #JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET}
|
||||||
* 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
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("JavaDoc")
|
@Deprecated
|
||||||
String HBM2DDL_SCRIPTS_CREATE_TARGET = "javax.persistence.schema-generation.scripts.create-target";
|
String HBM2DDL_SCRIPTS_CREATE_TARGET = "javax.persistence.schema-generation.scripts.create-target";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +60,7 @@ protected void configure(Configuration configuration) {
|
|||||||
fail( e.getMessage() );
|
fail( e.getMessage() );
|
||||||
}
|
}
|
||||||
String value = output.toPath().toString();
|
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.HBM2DDL_SCRIPTS_ACTION, "create" );
|
||||||
configuration.setProperty( AvailableSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, "create-drop" );
|
configuration.setProperty( AvailableSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, "create-drop" );
|
||||||
configuration.setProperty( AvailableSettings.FORMAT_SQL, "false" );
|
configuration.setProperty( AvailableSettings.FORMAT_SQL, "false" );
|
||||||
|
@ -689,7 +689,7 @@ private String generateScriptFromSessionFactory(String action) {
|
|||||||
);
|
);
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
settings.put( AvailableSettings.HBM2DDL_SCRIPTS_ACTION, action );
|
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 );
|
settings.put( AvailableSettings.HBM2DDL_SCRIPTS_DROP_TARGET, writer );
|
||||||
|
|
||||||
SchemaManagementToolCoordinator.process(
|
SchemaManagementToolCoordinator.process(
|
||||||
|
@ -101,7 +101,7 @@ protected void addConfigOptions(Map settings) {
|
|||||||
ssr.close();
|
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
|
DROP_TABLE + ";" + DROP_SEQUENCE
|
||||||
) );
|
) );
|
||||||
settings.put( AvailableSettings.SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGY, SequenceMismatchStrategy.FIX );
|
settings.put( AvailableSettings.SEQUENCE_INCREMENT_SIZE_MISMATCH_STRATEGY, SequenceMismatchStrategy.FIX );
|
||||||
|
@ -91,7 +91,7 @@ public void testSqlDropScriptSourceClasspath() {
|
|||||||
Map<Object, Object> settings = buildSettings();
|
Map<Object, Object> settings = buildSettings();
|
||||||
settings.put( AvailableSettings.JAKARTA_HBM2DDL_DROP_SOURCE, "metadata-then-script" );
|
settings.put( AvailableSettings.JAKARTA_HBM2DDL_DROP_SOURCE, "metadata-then-script" );
|
||||||
settings.put( AvailableSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, "drop" );
|
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 );
|
doTest( settings );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ public void testSqlDropScriptSourceUrl() {
|
|||||||
Map<Object, Object> settings = buildSettings();
|
Map<Object, Object> settings = buildSettings();
|
||||||
settings.put( AvailableSettings.JAKARTA_HBM2DDL_DROP_SOURCE, "metadata-then-script" );
|
settings.put( AvailableSettings.JAKARTA_HBM2DDL_DROP_SOURCE, "metadata-then-script" );
|
||||||
settings.put( AvailableSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, "drop" );
|
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 );
|
doTest( settings );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hibernate.cfg.AvailableSettings.HBM2DDL_SCRIPTS_ACTION;
|
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.HBM2DDL_SCRIPTS_DROP_TARGET;
|
||||||
|
import static org.hibernate.cfg.AvailableSettings.JAKARTA_HBM2DDL_SCRIPTS_CREATE_TARGET;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,7 +45,7 @@ public class SchemaCreateDropUtf8WithoutHbm2DdlCharsetNameTest {
|
|||||||
|
|
||||||
protected Map getConfig() {
|
protected Map getConfig() {
|
||||||
final Map<Object, Object> config = Environment.getProperties();
|
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_DROP_TARGET, dropSchema.toPath() );
|
||||||
config.put( HBM2DDL_SCRIPTS_ACTION, "drop-and-create" );
|
config.put( HBM2DDL_SCRIPTS_ACTION, "drop-and-create" );
|
||||||
ArrayList<Class> classes = new ArrayList<Class>();
|
ArrayList<Class> classes = new ArrayList<Class>();
|
||||||
|
@ -108,7 +108,7 @@ private PersistenceUnitDescriptor buildPersistenceUnitDescriptor() {
|
|||||||
|
|
||||||
private Map getConfig() {
|
private Map getConfig() {
|
||||||
final Map<Object, Object> config = Environment.getProperties();
|
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_DROP_TARGET, dropSchema.toPath() );
|
||||||
config.put( AvailableSettings.HBM2DDL_SCRIPTS_ACTION, "drop-and-create" );
|
config.put( AvailableSettings.HBM2DDL_SCRIPTS_ACTION, "drop-and-create" );
|
||||||
ArrayList<Class> classes = new ArrayList<Class>();
|
ArrayList<Class> classes = new ArrayList<Class>();
|
||||||
|
@ -68,7 +68,7 @@ protected void configure(Configuration configuration) {
|
|||||||
}
|
}
|
||||||
this.output.deleteOnExit();
|
this.output.deleteOnExit();
|
||||||
configuration.setProperty( Environment.HBM2DDL_SCRIPTS_ACTION, "create" );
|
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
|
@Override
|
||||||
|
@ -80,7 +80,7 @@ private void createServiceRegistryAndMetadata(String append) {
|
|||||||
final StandardServiceRegistryBuilder standardServiceRegistryBuilder = new StandardServiceRegistryBuilder()
|
final StandardServiceRegistryBuilder standardServiceRegistryBuilder = new StandardServiceRegistryBuilder()
|
||||||
.applySetting( Environment.FORMAT_SQL, "false" )
|
.applySetting( Environment.FORMAT_SQL, "false" )
|
||||||
.applySetting( Environment.HBM2DDL_SCRIPTS_ACTION, "create" )
|
.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 ) {
|
if ( append != null ) {
|
||||||
standardServiceRegistryBuilder.applySetting( AvailableSettings.HBM2DDL_SCRIPTS_CREATE_APPEND, append );
|
standardServiceRegistryBuilder.applySetting( AvailableSettings.HBM2DDL_SCRIPTS_CREATE_APPEND, append );
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ protected void configure(Configuration configuration) {
|
|||||||
output.deleteOnExit();
|
output.deleteOnExit();
|
||||||
configuration.setProperty( Environment.JAKARTA_HBM2DDL_DATABASE_ACTION, "update" );
|
configuration.setProperty( Environment.JAKARTA_HBM2DDL_DATABASE_ACTION, "update" );
|
||||||
configuration.setProperty( Environment.HBM2DDL_SCRIPTS_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
|
@After
|
||||||
|
@ -92,7 +92,7 @@ private void createServiceRegistryAndMetadata(String append) {
|
|||||||
final StandardServiceRegistryBuilder standardServiceRegistryBuilder = new StandardServiceRegistryBuilder()
|
final StandardServiceRegistryBuilder standardServiceRegistryBuilder = new StandardServiceRegistryBuilder()
|
||||||
.applySetting( Environment.FORMAT_SQL, "false" )
|
.applySetting( Environment.FORMAT_SQL, "false" )
|
||||||
.applySetting( Environment.HBM2DDL_SCRIPTS_ACTION, "update" )
|
.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 ) {
|
if ( append != null ) {
|
||||||
standardServiceRegistryBuilder.applySetting( AvailableSettings.HBM2DDL_SCRIPTS_CREATE_APPEND, append );
|
standardServiceRegistryBuilder.applySetting( AvailableSettings.HBM2DDL_SCRIPTS_CREATE_APPEND, append );
|
||||||
|
@ -54,7 +54,7 @@ public void buildEntityManagerFactory() throws Exception {
|
|||||||
@Override
|
@Override
|
||||||
protected void addConfigOptions(Map options) {
|
protected void addConfigOptions(Map options) {
|
||||||
super.addConfigOptions( 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_DROP_TARGET, dropSchema.toPath() );
|
||||||
options.put( AvailableSettings.HBM2DDL_SCRIPTS_ACTION, "drop-and-create" );
|
options.put( AvailableSettings.HBM2DDL_SCRIPTS_ACTION, "drop-and-create" );
|
||||||
options.put( AvailableSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, "create-drop" );
|
options.put( AvailableSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, "create-drop" );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user