remove deprecated operations from SessionFactoryBuilder
This commit is contained in:
parent
f0fa64bda8
commit
9c37385cb9
|
@ -395,25 +395,6 @@ public interface SessionFactoryBuilder {
|
|||
*/
|
||||
SessionFactoryBuilder applyPreferUserTransactions(boolean preferUserTransactions);
|
||||
|
||||
/**
|
||||
* Should we strictly adhere to JPA Query Language (JPQL) syntax, or more broadly support
|
||||
* all of Hibernate's superset (HQL)?
|
||||
* <p/>
|
||||
* Setting this to {@code true} may cause valid HQL to throw an exception because it violates
|
||||
* the JPQL subset.
|
||||
*
|
||||
* @param enabled {@code true} indicates that we should strictly adhere to the JPQL subset; {@code false}
|
||||
* indicates we should accept the broader HQL syntax.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*
|
||||
* @see org.hibernate.cfg.AvailableSettings#JPAQL_STRICT_COMPLIANCE
|
||||
*
|
||||
* @deprecated Use {@link #enableJpaQueryCompliance} instead
|
||||
*/
|
||||
@Deprecated
|
||||
SessionFactoryBuilder applyStrictJpaQueryLanguageCompliance(boolean enabled);
|
||||
|
||||
/**
|
||||
* Should named queries be checked on startup?
|
||||
*
|
||||
|
@ -618,26 +599,10 @@ public interface SessionFactoryBuilder {
|
|||
*/
|
||||
SessionFactoryBuilder applyConnectionHandlingMode(PhysicalConnectionHandlingMode connectionHandlingMode);
|
||||
|
||||
/**
|
||||
* Apply a ConnectionReleaseMode.
|
||||
*
|
||||
* @param connectionReleaseMode The ConnectionReleaseMode to use.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*
|
||||
* @see org.hibernate.cfg.AvailableSettings#RELEASE_CONNECTIONS
|
||||
*
|
||||
* @deprecated Use {@link #applyConnectionHandlingMode} instead
|
||||
*/
|
||||
@Deprecated
|
||||
SessionFactoryBuilder applyConnectionReleaseMode(ConnectionReleaseMode connectionReleaseMode);
|
||||
|
||||
/**
|
||||
* @see org.hibernate.cfg.AvailableSettings#CONNECTION_PROVIDER_DISABLES_AUTOCOMMIT
|
||||
*/
|
||||
default SessionFactoryBuilder applyConnectionProviderDisablesAutoCommit(boolean providerDisablesAutoCommit) {
|
||||
return this;
|
||||
}
|
||||
SessionFactoryBuilder applyConnectionProviderDisablesAutoCommit(boolean providerDisablesAutoCommit);
|
||||
|
||||
/**
|
||||
* Should Hibernate apply comments to SQL it generates?
|
||||
|
@ -652,15 +617,14 @@ public interface SessionFactoryBuilder {
|
|||
|
||||
/**
|
||||
* Apply a SQLFunction to the underlying {@link org.hibernate.query.sqm.function.SqmFunctionRegistry}.
|
||||
* <p/>
|
||||
* TODO : Ultimately I would like this to move to {@link MetadataBuilder} in conjunction with allowing mappings to reference SQLFunctions.
|
||||
* today mappings can only name SQL functions directly, not through the SQLFunctionRegistry indirection
|
||||
*
|
||||
* @param registrationName The name to register it under.
|
||||
* @param functionDescriptor The SQLFunction impl
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
// Ultimately I would like this to move to {@link MetadataBuilder} in conjunction with allowing mappings to reference SQLFunctions.
|
||||
// today mappings can only name SQL functions directly, not through the SQLFunctionRegistry indirection
|
||||
SessionFactoryBuilder applySqlFunction(String registrationName, SqmFunctionDescriptor functionDescriptor);
|
||||
|
||||
/**
|
||||
|
|
|
@ -349,12 +349,6 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionFactoryBuilder applyConnectionReleaseMode(ConnectionReleaseMode connectionReleaseMode) {
|
||||
this.optionsBuilder.applyConnectionReleaseMode( connectionReleaseMode );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionFactoryBuilder applyConnectionProviderDisablesAutoCommit(boolean providerDisablesAutoCommit) {
|
||||
this.optionsBuilder.applyConnectionProviderDisablesAutoCommit( providerDisablesAutoCommit );
|
||||
|
@ -391,13 +385,6 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SessionFactoryBuilder applyStrictJpaQueryLanguageCompliance(boolean enabled) {
|
||||
this.optionsBuilder.enableStrictJpaQueryLanguageCompliance( enabled );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionFactoryBuilder enableJpaQueryCompliance(boolean enabled) {
|
||||
this.optionsBuilder.enableJpaQueryCompliance( enabled );
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.TimeZone;
|
|||
import java.util.concurrent.Callable;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.hibernate.ConnectionAcquisitionMode;
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.CustomEntityDirtinessStrategy;
|
||||
import org.hibernate.EmptyInterceptor;
|
||||
|
@ -179,12 +178,12 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
private Class<? extends Interceptor> statelessInterceptorClass;
|
||||
private Supplier<? extends Interceptor> statelessInterceptorSupplier;
|
||||
private StatementInspector statementInspector;
|
||||
private List<SessionFactoryObserver> sessionFactoryObserverList = new ArrayList<>();
|
||||
private BaselineSessionEventsListenerBuilder baselineSessionEventsListenerBuilder; // not exposed on builder atm
|
||||
private final List<SessionFactoryObserver> sessionFactoryObserverList = new ArrayList<>();
|
||||
private final BaselineSessionEventsListenerBuilder baselineSessionEventsListenerBuilder; // not exposed on builder atm
|
||||
|
||||
// persistence behavior
|
||||
private CustomEntityDirtinessStrategy customEntityDirtinessStrategy;
|
||||
private List<EntityNameResolver> entityNameResolvers = new ArrayList<>();
|
||||
private final List<EntityNameResolver> entityNameResolvers = new ArrayList<>();
|
||||
private EntityNotFoundDelegate entityNotFoundDelegate;
|
||||
private boolean identifierRollbackEnabled;
|
||||
private EntityTuplizerFactory entityTuplizerFactory = new EntityTuplizerFactory();
|
||||
|
@ -269,10 +268,8 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
ConfigurationService cfgService = serviceRegistry.getService( ConfigurationService.class );
|
||||
final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
|
||||
|
||||
final Map configurationSettings = new HashMap();
|
||||
//noinspection unchecked
|
||||
final Map<Object,Object> configurationSettings = new HashMap<>();
|
||||
configurationSettings.putAll( jdbcServices.getJdbcEnvironment().getDialect().getDefaultProperties() );
|
||||
//noinspection unchecked
|
||||
configurationSettings.putAll( cfgService.getSettings() );
|
||||
if ( cfgService == null ) {
|
||||
cfgService = new ConfigurationServiceImpl( configurationSettings );
|
||||
|
@ -390,7 +387,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
);
|
||||
this.sqmTranslatorFactory = resolveSqmTranslator(
|
||||
sqmTranslatorFactoryImplFqn,
|
||||
serviceRegistry,
|
||||
strategySelector
|
||||
);
|
||||
|
||||
|
@ -572,6 +568,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private SqmMultiTableMutationStrategy resolveSqmMutationStrategy(
|
||||
String strategyName,
|
||||
StandardServiceRegistry serviceRegistry,
|
||||
|
@ -620,6 +617,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private SqmMultiTableInsertStrategy resolveSqmInsertStrategy(
|
||||
String strategyName,
|
||||
StandardServiceRegistry serviceRegistry,
|
||||
|
@ -680,7 +678,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
return strategySelector.resolveDefaultableStrategy(
|
||||
HqlTranslator.class,
|
||||
producerName,
|
||||
new Callable<HqlTranslator>() {
|
||||
new Callable<>() {
|
||||
@Override
|
||||
public HqlTranslator call() throws Exception {
|
||||
final ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
|
||||
|
@ -692,7 +690,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
|
||||
private SqmTranslatorFactory resolveSqmTranslator(
|
||||
String translatorImplFqn,
|
||||
StandardServiceRegistry serviceRegistry,
|
||||
StrategySelector strategySelector) {
|
||||
if ( StringHelper.isEmpty( translatorImplFqn ) ) {
|
||||
return null;
|
||||
|
@ -704,8 +701,9 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static Interceptor determineInterceptor(Map configurationSettings, StrategySelector strategySelector) {
|
||||
private static Interceptor determineInterceptor(
|
||||
Map<Object,Object> configurationSettings,
|
||||
StrategySelector strategySelector) {
|
||||
Object setting = configurationSettings.get( INTERCEPTOR );
|
||||
if ( setting == null ) {
|
||||
// try the legacy (deprecated) JPA name
|
||||
|
@ -724,9 +722,9 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked" })
|
||||
@SuppressWarnings("unchecked")
|
||||
private static Supplier<? extends Interceptor> determineStatelessInterceptor(
|
||||
Map configurationSettings,
|
||||
Map<Object,Object> configurationSettings,
|
||||
StrategySelector strategySelector) {
|
||||
Object setting = configurationSettings.get( SESSION_SCOPED_INTERCEPTOR );
|
||||
|
||||
|
@ -763,7 +761,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
}
|
||||
|
||||
private PhysicalConnectionHandlingMode interpretConnectionHandlingMode(
|
||||
Map configurationSettings,
|
||||
Map<Object,Object> configurationSettings,
|
||||
StandardServiceRegistry serviceRegistry) {
|
||||
final PhysicalConnectionHandlingMode specifiedHandlingMode = PhysicalConnectionHandlingMode.interpret(
|
||||
configurationSettings.get( CONNECTION_HANDLING )
|
||||
|
@ -930,7 +928,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
|
||||
@Override
|
||||
public SessionFactoryObserver[] getSessionFactoryObservers() {
|
||||
return sessionFactoryObserverList.toArray( new SessionFactoryObserver[ sessionFactoryObserverList.size() ] );
|
||||
return sessionFactoryObserverList.toArray(new SessionFactoryObserver[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1120,7 +1118,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
|
||||
@Override
|
||||
public EntityNameResolver[] getEntityNameResolvers() {
|
||||
return entityNameResolvers.toArray( new EntityNameResolver[ entityNameResolvers.size() ] );
|
||||
return entityNameResolvers.toArray(new EntityNameResolver[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1410,21 +1408,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
this.connectionHandlingMode = mode;
|
||||
}
|
||||
|
||||
public void applyConnectionReleaseMode(ConnectionReleaseMode connectionReleaseMode) {
|
||||
if ( this.connectionHandlingMode == null ) {
|
||||
this.connectionHandlingMode = PhysicalConnectionHandlingMode.interpret(
|
||||
ConnectionAcquisitionMode.AS_NEEDED,
|
||||
connectionReleaseMode
|
||||
);
|
||||
}
|
||||
else {
|
||||
this.connectionHandlingMode = PhysicalConnectionHandlingMode.interpret(
|
||||
this.connectionHandlingMode.getAcquisitionMode(),
|
||||
connectionReleaseMode
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void applyConnectionProviderDisablesAutoCommit(boolean providerDisablesAutoCommit) {
|
||||
this.connectionProviderDisablesAutoCommit = providerDisablesAutoCommit;
|
||||
}
|
||||
|
@ -1448,16 +1431,12 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
this.releaseResourcesOnCloseEnabled = enable;
|
||||
}
|
||||
|
||||
public void enableStrictJpaQueryLanguageCompliance(boolean enabled) {
|
||||
enableJpaQueryCompliance( enabled );
|
||||
}
|
||||
|
||||
public void enableJpaQueryCompliance(boolean enabled) {
|
||||
mutableJpaCompliance().setQueryCompliance( enabled );
|
||||
}
|
||||
|
||||
private MutableJpaCompliance mutableJpaCompliance() {
|
||||
if ( ! MutableJpaCompliance.class.isInstance( this.jpaCompliance ) ) {
|
||||
if ( !(this.jpaCompliance instanceof MutableJpaCompliance) ) {
|
||||
throw new IllegalStateException( "JpaCompliance is no longer mutable" );
|
||||
}
|
||||
|
||||
|
@ -1506,7 +1485,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
}
|
||||
|
||||
public SessionFactoryOptions buildOptions() {
|
||||
if ( MutableJpaCompliance.class.isInstance( this.jpaCompliance ) ) {
|
||||
if ( this.jpaCompliance instanceof MutableJpaCompliance ) {
|
||||
this.jpaCompliance = mutableJpaCompliance().immutableCopy();
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.boot.spi;
|
|||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.CustomEntityDirtinessStrategy;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.Interceptor;
|
||||
|
@ -237,12 +236,6 @@ public abstract class AbstractDelegatingSessionFactoryBuilder<T extends SessionF
|
|||
return getThis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T applyStrictJpaQueryLanguageCompliance(boolean enabled) {
|
||||
delegate.applyStrictJpaQueryLanguageCompliance( enabled );
|
||||
return getThis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T applyNamedQueryCheckingOnStartup(boolean enabled) {
|
||||
delegate.applyNamedQueryCheckingOnStartup( enabled );
|
||||
|
@ -327,13 +320,6 @@ public abstract class AbstractDelegatingSessionFactoryBuilder<T extends SessionF
|
|||
return getThis();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public T applyConnectionReleaseMode(ConnectionReleaseMode connectionReleaseMode) {
|
||||
delegate.applyConnectionReleaseMode( connectionReleaseMode );
|
||||
return getThis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionFactoryBuilder applyConnectionProviderDisablesAutoCommit(boolean providerDisablesAutoCommit) {
|
||||
delegate.applyConnectionProviderDisablesAutoCommit( providerDisablesAutoCommit );
|
||||
|
|
|
@ -25,6 +25,8 @@ public interface JpaCompliance {
|
|||
* Deviations result in an exception if enabled
|
||||
*
|
||||
* @return {@code true} indicates to behave in the spec-defined way
|
||||
*
|
||||
* @see org.hibernate.cfg.AvailableSettings#JPA_QUERY_COMPLIANCE
|
||||
*/
|
||||
boolean isJpaQueryComplianceEnabled();
|
||||
|
||||
|
@ -34,6 +36,8 @@ public interface JpaCompliance {
|
|||
* since it extends the JPA one.
|
||||
*
|
||||
* @return {@code true} indicates to behave in the spec-defined way
|
||||
*
|
||||
* @see org.hibernate.cfg.AvailableSettings#JPA_TRANSACTION_COMPLIANCE
|
||||
*/
|
||||
boolean isJpaTransactionComplianceEnabled();
|
||||
|
||||
|
@ -48,6 +52,8 @@ public interface JpaCompliance {
|
|||
*
|
||||
* @return {@code true} indicates to behave in the spec-defined way, interpreting the
|
||||
* mapping as a "list", rather than a "bag"
|
||||
*
|
||||
* @see org.hibernate.cfg.AvailableSettings#JPA_LIST_COMPLIANCE
|
||||
*/
|
||||
boolean isJpaListComplianceEnabled();
|
||||
|
||||
|
@ -61,6 +67,8 @@ public interface JpaCompliance {
|
|||
* exceptions when the spec says it should with regard to close checking
|
||||
*
|
||||
* @return {@code true} indicates to behave in the spec-defined way
|
||||
*
|
||||
* @see org.hibernate.cfg.AvailableSettings#JPA_CLOSED_COMPLIANCE
|
||||
*/
|
||||
boolean isJpaClosedComplianceEnabled();
|
||||
|
||||
|
@ -76,6 +84,8 @@ public interface JpaCompliance {
|
|||
* If enabled Hibernate will initialize the entity Proxy even when accessing its identifier.
|
||||
*
|
||||
* @return {@code true} indicates to behave in the spec-defined way
|
||||
*
|
||||
* @see org.hibernate.cfg.AvailableSettings#JPA_PROXY_COMPLIANCE
|
||||
*/
|
||||
boolean isJpaProxyComplianceEnabled();
|
||||
|
||||
|
@ -88,6 +98,8 @@ public interface JpaCompliance {
|
|||
* than updated.
|
||||
*
|
||||
* @return {@code true} says to act the spec-defined way.
|
||||
*
|
||||
* @see org.hibernate.cfg.AvailableSettings#JPA_CACHING_COMPLIANCE
|
||||
*/
|
||||
boolean isJpaCacheComplianceEnabled();
|
||||
|
||||
|
@ -97,6 +109,8 @@ public interface JpaCompliance {
|
|||
* defined?
|
||||
*
|
||||
* @return {@code true} indicates the generator name scope is considered global.
|
||||
*
|
||||
* @see org.hibernate.cfg.AvailableSettings#JPA_ID_GENERATOR_GLOBAL_SCOPE_COMPLIANCE
|
||||
*/
|
||||
boolean isGlobalGeneratorScopeEnabled();
|
||||
|
||||
|
@ -106,6 +120,8 @@ public interface JpaCompliance {
|
|||
* JPA says the order-items can only be attribute references whereas Hibernate supports a
|
||||
* wide range of items. With this enabled, Hibernate will throw a compliance error when a
|
||||
* non-attribute-reference is used.
|
||||
*
|
||||
* @see org.hibernate.cfg.AvailableSettings#JPA_ORDER_BY_MAPPING_COMPLIANCE
|
||||
*/
|
||||
boolean isJpaOrderByMappingComplianceEnabled();
|
||||
|
||||
|
@ -121,6 +137,8 @@ public interface JpaCompliance {
|
|||
* <p>
|
||||
* This setting controls whether such a coercion should be allowed.
|
||||
*
|
||||
* @see org.hibernate.cfg.AvailableSettings#JPA_LOAD_BY_ID_COMPLIANCE
|
||||
*
|
||||
* @since 6.0
|
||||
*/
|
||||
boolean isLoadByIdComplianceEnabled();
|
||||
|
|
Loading…
Reference in New Issue