HHH-11944 Add missing methods to AbstractDelegatingSessionFactoryBuilder

This commit is contained in:
Guillaume Smet 2017-08-25 17:58:26 +02:00
parent e8441e5313
commit 626c8abc71
1 changed files with 26 additions and 1 deletions

View File

@ -15,6 +15,7 @@ import org.hibernate.EntityNameResolver;
import org.hibernate.Interceptor; import org.hibernate.Interceptor;
import org.hibernate.MultiTenancyStrategy; import org.hibernate.MultiTenancyStrategy;
import org.hibernate.NullPrecedence; import org.hibernate.NullPrecedence;
import org.hibernate.SessionFactory;
import org.hibernate.SessionFactoryObserver; import org.hibernate.SessionFactoryObserver;
import org.hibernate.boot.SessionFactoryBuilder; import org.hibernate.boot.SessionFactoryBuilder;
import org.hibernate.boot.TempTableDdlTransactionHandling; import org.hibernate.boot.TempTableDdlTransactionHandling;
@ -24,6 +25,7 @@ import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.hql.spi.id.MultiTableBulkIdStrategy; import org.hibernate.hql.spi.id.MultiTableBulkIdStrategy;
import org.hibernate.loader.BatchFetchStyle; import org.hibernate.loader.BatchFetchStyle;
import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.proxy.EntityNotFoundDelegate;
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
import org.hibernate.resource.jdbc.spi.StatementInspector; import org.hibernate.resource.jdbc.spi.StatementInspector;
import org.hibernate.tuple.entity.EntityTuplizer; import org.hibernate.tuple.entity.EntityTuplizer;
import org.hibernate.tuple.entity.EntityTuplizerFactory; import org.hibernate.tuple.entity.EntityTuplizerFactory;
@ -33,6 +35,7 @@ import org.hibernate.tuple.entity.EntityTuplizerFactory;
* *
* @author Steve Ebersole * @author Steve Ebersole
* @author Gunnar Morling * @author Gunnar Morling
* @author Guillaume Smet
* @param <T> The type of a specific sub-class; Allows sub-classes to narrow down the return-type of the contract methods * @param <T> The type of a specific sub-class; Allows sub-classes to narrow down the return-type of the contract methods
* to a specialization of {@link SessionFactoryBuilder} * to a specialization of {@link SessionFactoryBuilder}
*/ */
@ -50,6 +53,10 @@ public abstract class AbstractDelegatingSessionFactoryBuilder<T extends Abstract
*/ */
protected abstract T getThis(); protected abstract T getThis();
protected SessionFactoryBuilder getDelegate() {
return delegate;
}
@Override @Override
public T applyValidatorFactory(Object validatorFactory) { public T applyValidatorFactory(Object validatorFactory) {
delegate.applyValidatorFactory( validatorFactory ); delegate.applyValidatorFactory( validatorFactory );
@ -342,6 +349,7 @@ public abstract class AbstractDelegatingSessionFactoryBuilder<T extends Abstract
return getThis(); return getThis();
} }
@SuppressWarnings("deprecation")
@Override @Override
public T applyConnectionReleaseMode(ConnectionReleaseMode connectionReleaseMode) { public T applyConnectionReleaseMode(ConnectionReleaseMode connectionReleaseMode) {
delegate.applyConnectionReleaseMode( connectionReleaseMode ); delegate.applyConnectionReleaseMode( connectionReleaseMode );
@ -375,7 +383,7 @@ public abstract class AbstractDelegatingSessionFactoryBuilder<T extends Abstract
} }
@Override @Override
public SessionFactoryBuilder enableReleaseResourcesOnCloseEnabled(boolean enable) { public T enableReleaseResourcesOnCloseEnabled(boolean enable) {
delegate.enableReleaseResourcesOnCloseEnabled( enable ); delegate.enableReleaseResourcesOnCloseEnabled( enable );
return getThis(); return getThis();
} }
@ -385,4 +393,21 @@ public abstract class AbstractDelegatingSessionFactoryBuilder<T extends Abstract
public <S extends SessionFactoryBuilder> S unwrap(Class<S> type) { public <S extends SessionFactoryBuilder> S unwrap(Class<S> type) {
return (S) this; return (S) this;
} }
@Override
public T applyStatelessInterceptor(Class<? extends Interceptor> statelessInterceptorClass) {
delegate.applyStatelessInterceptor( statelessInterceptorClass );
return getThis();
}
@Override
public T applyConnectionHandlingMode(PhysicalConnectionHandlingMode connectionHandlingMode) {
delegate.applyConnectionHandlingMode( connectionHandlingMode );
return getThis();
}
@Override
public SessionFactory build() {
return delegate.build();
}
} }