Skip to content

Commit 122b85c

Browse files
committed
HHH-19349 deprecate unused SessionFactoryOptions
- SchemaAutoTooling is completely obsolete and unused - TempTableDdlTransactionHandling appears to also be obsolete; it's still overridable by a custom Dialect but no Dialect actually does override it
1 parent 4d9e308 commit 122b85c

10 files changed

+34
-7
lines changed

hibernate-core/src/main/java/org/hibernate/boot/SchemaAutoTooling.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
/**
1313
* Defines the possible values for {@value AvailableSettings#HBM2DDL_AUTO}.
1414
*
15+
* @deprecated This enumeration is currently unused and will be removed.
16+
*
1517
* @author Steve Ebersole
1618
*/
19+
@Deprecated(since = "7.0", forRemoval = true)
1720
public enum SchemaAutoTooling {
1821
/**
1922
* Drop the schema and recreate it on {@code SessionFactory} startup.

hibernate-core/src/main/java/org/hibernate/boot/SessionFactoryBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,10 @@ public interface SessionFactoryBuilder {
263263
* to transaction handling.
264264
*
265265
* @see TempTableDdlTransactionHandling
266+
*
267+
* @deprecated This has no effect and will be removed.
266268
*/
269+
@Deprecated(since = "7.0", forRemoval = true)
267270
SessionFactoryBuilder applyTempTableDdlTransactionHandling(TempTableDdlTransactionHandling handling);
268271

269272
/**

hibernate-core/src/main/java/org/hibernate/boot/TempTableDdlTransactionHandling.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
* transaction handling.
1010
*
1111
* @author Steve Ebersole
12+
*
13+
* @see org.hibernate.dialect.Dialect#getTemporaryTableDdlTransactionHandling
14+
*
15+
* @deprecated All dialects currently use {@link #NONE}, so it's obsolete.
1216
*/
17+
@Deprecated(since = "7.0")
1318
public enum TempTableDdlTransactionHandling {
1419
/**
1520
* No handling of transactions is needed

hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public SessionFactoryBuilder applyLazyInitializationOutsideTransaction(boolean e
192192
return this;
193193
}
194194

195-
@Override
195+
@Override @Deprecated
196196
public SessionFactoryBuilder applyTempTableDdlTransactionHandling(TempTableDdlTransactionHandling handling) {
197197
this.optionsBuilder.applyTempTableDdlTransactionHandling( handling );
198198
return this;

hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,13 +443,15 @@ public SessionFactoryOptionsBuilder(StandardServiceRegistry serviceRegistry, Boo
443443
autoEvictCollectionCache = false;
444444
}
445445

446+
// deprecated
446447
try {
447448
schemaAutoTooling = SchemaAutoTooling.interpret( (String) settings.get( AvailableSettings.HBM2DDL_AUTO ) );
448449
}
449450
catch (Exception e) {
450451
log.warn( e.getMessage() + " Ignoring" );
451452
}
452453

454+
// deprecated
453455
final ExtractedDatabaseMetaData meta = jdbcServices.getExtractedMetaDataSupport();
454456
if ( meta.doesDataDefinitionCauseTransactionCommit() ) {
455457
tempTableDdlTransactionHandling =
@@ -936,7 +938,7 @@ public boolean isInitializeLazyStateOutsideTransactionsEnabled() {
936938
return initializeLazyStateOutsideTransactions;
937939
}
938940

939-
@Override
941+
@Override @Deprecated
940942
public TempTableDdlTransactionHandling getTempTableDdlTransactionHandling() {
941943
return tempTableDdlTransactionHandling;
942944
}
@@ -1041,7 +1043,7 @@ public boolean isAutoEvictCollectionCache() {
10411043
return autoEvictCollectionCache;
10421044
}
10431045

1044-
@Override
1046+
@Override @Deprecated
10451047
public SchemaAutoTooling getSchemaAutoTooling() {
10461048
return schemaAutoTooling;
10471049
}
@@ -1381,6 +1383,7 @@ public void allowLazyInitializationOutsideTransaction(boolean enabled) {
13811383
this.initializeLazyStateOutsideTransactions = enabled;
13821384
}
13831385

1386+
@Deprecated(forRemoval = true)
13841387
public void applyTempTableDdlTransactionHandling(TempTableDdlTransactionHandling handling) {
13851388
this.tempTableDdlTransactionHandling = handling;
13861389
}

hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public T applyLazyInitializationOutsideTransaction(boolean enabled) {
148148
return getThis();
149149
}
150150

151-
@Override
151+
@Override @Deprecated
152152
public T applyTempTableDdlTransactionHandling(TempTableDdlTransactionHandling handling) {
153153
delegate.applyTempTableDdlTransactionHandling( handling );
154154
return getThis();

hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public boolean isInitializeLazyStateOutsideTransactionsEnabled() {
174174
return delegate.isInitializeLazyStateOutsideTransactionsEnabled();
175175
}
176176

177-
@Override
177+
@Override @Deprecated
178178
public TempTableDdlTransactionHandling getTempTableDdlTransactionHandling() {
179179
return delegate.getTempTableDdlTransactionHandling();
180180
}
@@ -294,7 +294,7 @@ public boolean isAutoEvictCollectionCache() {
294294
return delegate.isAutoEvictCollectionCache();
295295
}
296296

297-
@Override
297+
@Override @Deprecated
298298
public SchemaAutoTooling getSchemaAutoTooling() {
299299
return delegate.getSchemaAutoTooling();
300300
}

hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ default boolean isAllowRefreshDetachedEntity() {
190190
*/
191191
boolean isInitializeLazyStateOutsideTransactionsEnabled();
192192

193+
/**
194+
* This is unused and will be removed.
195+
*/
196+
@Deprecated(since = "7.0", forRemoval = true)
193197
TempTableDdlTransactionHandling getTempTableDdlTransactionHandling();
194198

195199
/**
@@ -290,6 +294,12 @@ default boolean isAllowRefreshDetachedEntity() {
290294
*/
291295
boolean isAutoEvictCollectionCache();
292296

297+
/**
298+
* @see org.hibernate.cfg.AvailableSettings#HBM2DDL_AUTO
299+
*
300+
* @deprecated This is unused and will be removed.
301+
*/
302+
@Deprecated(since = "7.0", forRemoval = true)
293303
SchemaAutoTooling getSchemaAutoTooling();
294304

295305
/**

hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3562,7 +3562,10 @@ public String getCreateTemporaryTableColumnAnnotation(int sqlTypeCode) {
35623562
/**
35633563
* The sort of {@linkplain TempTableDdlTransactionHandling transaction handling}
35643564
* to use when creating or dropping temporary tables.
3565+
*
3566+
* @deprecated No dialect currently overrides this, so it's obsolete
35653567
*/
3568+
@Deprecated(since = "7.0")
35663569
public TempTableDdlTransactionHandling getTemporaryTableDdlTransactionHandling() {
35673570
return TempTableDdlTransactionHandling.NONE;
35683571
}

hibernate-core/src/main/java/org/hibernate/dialect/DialectDelegateWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ public String getCreateTemporaryTableColumnAnnotation(int sqlTypeCode) {
924924
return wrapped.getCreateTemporaryTableColumnAnnotation( sqlTypeCode );
925925
}
926926

927-
@Override
927+
@Override @Deprecated
928928
public TempTableDdlTransactionHandling getTemporaryTableDdlTransactionHandling() {
929929
return wrapped.getTemporaryTableDdlTransactionHandling();
930930
}

0 commit comments

Comments
 (0)