Skip to content

Commit cc306ac

Browse files
jrenaatsebersole
authored andcommitted
HHH-17162 - Deprecate/rename former bulk id strategy settings
Signed-off-by: Jan Schatteman <[email protected]>
1 parent 2c9ce29 commit cc306ac

File tree

8 files changed

+51
-10
lines changed

8 files changed

+51
-10
lines changed

hibernate-core/src/main/java/org/hibernate/cfg/SchemaToolingSettings.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,32 +331,47 @@ public interface SchemaToolingSettings {
331331
/**
332332
* Allows creation of {@linkplain org.hibernate.dialect.temptable.TemporaryTableKind#PERSISTENT persistent}
333333
* temporary tables at application startup to be disabled. By default, table creation is enabled.
334+
*
335+
* @deprecated Use {@link PersistentTableStrategy#CREATE_ID_TABLES}.
334336
*/
337+
@Deprecated(forRemoval = true)
335338
String BULK_ID_STRATEGY_PERSISTENT_TEMPORARY_CREATE_TABLES = PersistentTableStrategy.CREATE_ID_TABLES;
336339

337340
/**
338341
* Allows dropping of {@linkplain org.hibernate.dialect.temptable.TemporaryTableKind#PERSISTENT persistent}
339342
* temporary tables at application shutdown to be disabled. By default, table dropping is enabled.
343+
*
344+
* @deprecated Use {@link PersistentTableStrategy#DROP_ID_TABLES}.
340345
*/
346+
@Deprecated(forRemoval = true)
341347
String BULK_ID_STRATEGY_PERSISTENT_TEMPORARY_DROP_TABLES = PersistentTableStrategy.DROP_ID_TABLES;
342348

343349
/**
344350
* Allows creation of {@linkplain org.hibernate.dialect.temptable.TemporaryTableKind#GLOBAL global}
345351
* temporary tables at application startup to be disabled. By default, table creation is enabled.
352+
*
353+
* @deprecated Use {@link GlobalTemporaryTableStrategy#CREATE_ID_TABLES}.
346354
*/
355+
@Deprecated(forRemoval = true)
347356
String BULK_ID_STRATEGY_GLOBAL_TEMPORARY_CREATE_TABLES = GlobalTemporaryTableStrategy.CREATE_ID_TABLES;
348357

349358
/**
350359
* Allows dropping of {@linkplain org.hibernate.dialect.temptable.TemporaryTableKind#GLOBAL global}
351360
* temporary tables at application shutdown to be disabled. By default, table dropping is enabled.
361+
*
362+
* @deprecated Use {@link GlobalTemporaryTableStrategy#DROP_ID_TABLES}.
352363
*/
364+
@Deprecated(forRemoval = true)
353365
String BULK_ID_STRATEGY_GLOBAL_TEMPORARY_DROP_TABLES = GlobalTemporaryTableStrategy.DROP_ID_TABLES;
354366

355367
/**
356368
* Allows dropping of {@linkplain org.hibernate.dialect.temptable.TemporaryTableKind#LOCAL local}
357369
* temporary tables at transaction commit to be enabled. By default, table dropping is disabled,
358370
* and the database will drop the temporary tables automatically.
371+
*
372+
* @deprecated Use {@link LocalTemporaryTableStrategy#DROP_ID_TABLES}.
359373
*/
374+
@Deprecated(forRemoval = true)
360375
String BULK_ID_STRATEGY_LOCAL_TEMPORARY_DROP_TABLES = LocalTemporaryTableStrategy.DROP_ID_TABLES;
361376

362377

hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@
9999
import org.hibernate.query.sql.spi.NativeQueryImplementor;
100100
import org.hibernate.query.sqm.NodeBuilder;
101101
import org.hibernate.query.sqm.function.SqmFunctionRegistry;
102+
import org.hibernate.query.sqm.mutation.internal.temptable.GlobalTemporaryTableStrategy;
103+
import org.hibernate.query.sqm.mutation.internal.temptable.LocalTemporaryTableStrategy;
104+
import org.hibernate.query.sqm.mutation.internal.temptable.PersistentTableStrategy;
102105
import org.hibernate.query.sqm.spi.NamedSqmQueryMemento;
103106
import org.hibernate.relational.SchemaManager;
104107
import org.hibernate.relational.internal.SchemaManagerImpl;
@@ -132,6 +135,7 @@
132135
import static org.hibernate.cfg.AvailableSettings.JAKARTA_VALIDATION_FACTORY;
133136
import static org.hibernate.cfg.AvailableSettings.JPA_VALIDATION_FACTORY;
134137
import static org.hibernate.internal.FetchProfileHelper.getFetchProfiles;
138+
import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER;
135139
import static org.hibernate.internal.util.config.ConfigurationHelper.getBoolean;
136140
import static org.hibernate.jpa.HibernateHints.HINT_TENANT_ID;
137141
import static org.hibernate.proxy.HibernateProxy.extractLazyInitializer;
@@ -228,6 +232,7 @@ public SessionFactoryImpl(
228232

229233
settings = getSettings( options, serviceRegistry );
230234
maskOutSensitiveInformation( settings );
235+
deprecationCheck( settings );
231236
LOG.debugf( "Instantiating SessionFactory with settings: %s", settings);
232237
logIfEmptyCompositesEnabled( settings );
233238

@@ -329,6 +334,27 @@ public SessionFactoryImpl(
329334
LOG.debug( "Instantiated SessionFactory" );
330335
}
331336

337+
private void deprecationCheck(Map<String, Object> settings) {
338+
for ( String s:settings.keySet() ) {
339+
switch (s) {
340+
case "hibernate.hql.bulk_id_strategy.global_temporary.create_tables":
341+
DEPRECATION_LOGGER.deprecatedSetting( "hibernate.hql.bulk_id_strategy.global_temporary.create_tables", GlobalTemporaryTableStrategy.CREATE_ID_TABLES );
342+
case "hibernate.hql.bulk_id_strategy.global_temporary.drop_tables":
343+
DEPRECATION_LOGGER.deprecatedSetting( "hibernate.hql.bulk_id_strategy.global_temporary.drop_tables", GlobalTemporaryTableStrategy.DROP_ID_TABLES );
344+
case "hibernate.hql.bulk_id_strategy.persistent.create_tables":
345+
DEPRECATION_LOGGER.deprecatedSetting( "hibernate.hql.bulk_id_strategy.persistent.create_tables", PersistentTableStrategy.CREATE_ID_TABLES );
346+
case "hibernate.hql.bulk_id_strategy.persistent.drop_tables":
347+
DEPRECATION_LOGGER.deprecatedSetting( "hibernate.hql.bulk_id_strategy.persistent.drop_tables", PersistentTableStrategy.DROP_ID_TABLES );
348+
case "hibernate.hql.bulk_id_strategy.persistent.schema":
349+
DEPRECATION_LOGGER.deprecatedSetting( "hibernate.hql.bulk_id_strategy.persistent.schema", PersistentTableStrategy.SCHEMA );
350+
case "hibernate.hql.bulk_id_strategy.persistent.catalog":
351+
DEPRECATION_LOGGER.deprecatedSetting( "hibernate.hql.bulk_id_strategy.persistent.catalog", PersistentTableStrategy.CATALOG );
352+
case "hibernate.hql.bulk_id_strategy.local_temporary.drop_tables":
353+
DEPRECATION_LOGGER.deprecatedSetting( "hibernate.hql.bulk_id_strategy.local_temporary.drop_tables", LocalTemporaryTableStrategy.DROP_ID_TABLES );
354+
}
355+
}
356+
}
357+
332358
private void initializeMappingModel(
333359
MappingMetamodelImpl mappingMetamodelImpl,
334360
BootstrapContext bootstrapContext,

hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/temptable/GlobalTemporaryTableStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ public class GlobalTemporaryTableStrategy {
3030

3131
public static final String SHORT_NAME = "global_temporary";
3232

33-
public static final String CREATE_ID_TABLES = "hibernate.hql.bulk_id_strategy.global_temporary.create_tables";
33+
public static final String CREATE_ID_TABLES = "hibernate.query.mutation_strategy.global_temporary.create_tables";
3434

35-
public static final String DROP_ID_TABLES = "hibernate.hql.bulk_id_strategy.global_temporary.drop_tables";
35+
public static final String DROP_ID_TABLES = "hibernate.query.mutation_strategy.global_temporary.drop_tables";
3636

3737
private final TemporaryTable temporaryTable;
3838

hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/temptable/LocalTemporaryTableStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
public class LocalTemporaryTableStrategy {
2323

2424
public static final String SHORT_NAME = "local_temporary";
25-
public static final String DROP_ID_TABLES = "hibernate.hql.bulk_id_strategy.local_temporary.drop_tables";
25+
public static final String DROP_ID_TABLES = "hibernate.query.mutation_strategy.local_temporary.drop_tables";
2626

2727
private final TemporaryTable temporaryTable;
2828
private final SessionFactoryImplementor sessionFactory;

hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/temptable/PersistentTableStrategy.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ public abstract class PersistentTableStrategy {
3232

3333
public static final String SHORT_NAME = "persistent";
3434

35-
public static final String CREATE_ID_TABLES = "hibernate.hql.bulk_id_strategy.persistent.create_tables";
35+
public static final String CREATE_ID_TABLES = "hibernate.query.mutation_strategy.persistent.create_tables";
3636

37-
public static final String DROP_ID_TABLES = "hibernate.hql.bulk_id_strategy.persistent.drop_tables";
37+
public static final String DROP_ID_TABLES = "hibernate.query.mutation_strategy.persistent.drop_tables";
3838

39-
public static final String SCHEMA = "hibernate.hql.bulk_id_strategy.persistent.schema";
39+
public static final String SCHEMA = "hibernate.query.mutation_strategy.persistent.schema";
4040

41-
public static final String CATALOG = "hibernate.hql.bulk_id_strategy.persistent.catalog";
41+
public static final String CATALOG = "hibernate.query.mutation_strategy.persistent.catalog";
4242

4343
private final TemporaryTable temporaryTable;
4444
private final SessionFactoryImplementor sessionFactory;

hibernate-core/src/test/resources/hibernate.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFa
2828
jakarta.persistence.validation.mode=NONE
2929
hibernate.service.allow_crawling=false
3030
hibernate.session.events.log=true
31-
hibernate.hql.bulk_id_strategy.global_temporary.drop_tables=true
31+
hibernate.query.mutation_strategy.global_temporary.drop_tables=true

hibernate-micrometer/src/test/resources/hibernate.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFa
2525
jakarta.persistence.validation.mode=NONE
2626
hibernate.service.allow_crawling=false
2727
hibernate.session.events.log=true
28-
hibernate.hql.bulk_id_strategy.global_temporary.drop_tables=true
28+
hibernate.query.mutation_strategy.global_temporary.drop_tables=true

hibernate-testing/src/test/resources/hibernate.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFa
2525
jakarta.persistence.validation.mode=NONE
2626
hibernate.service.allow_crawling=false
2727
hibernate.session.events.log=true
28-
hibernate.hql.bulk_id_strategy.global_temporary.drop_tables=true
28+
hibernate.query.mutation_strategy.global_temporary.drop_tables=true

0 commit comments

Comments
 (0)