HHH-10313 - Make SessionImplementor extend WrapperOptions
This commit is contained in:
parent
704671e17d
commit
8961937bbc
|
@ -40,7 +40,6 @@ import org.hibernate.collection.spi.PersistentCollection;
|
|||
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
||||
import org.hibernate.engine.query.spi.sql.NativeSQLQuerySpecification;
|
||||
import org.hibernate.internal.WrapperOptionsImpl;
|
||||
import org.hibernate.jdbc.ReturningWork;
|
||||
import org.hibernate.jdbc.Work;
|
||||
import org.hibernate.loader.custom.CustomQuery;
|
||||
|
@ -49,7 +48,6 @@ import org.hibernate.procedure.ProcedureCall;
|
|||
import org.hibernate.resource.transaction.TransactionCoordinator;
|
||||
import org.hibernate.stat.SessionStatistics;
|
||||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.WrapperOptionsContext;
|
||||
|
||||
/**
|
||||
* This class is meant to be extended.
|
||||
|
@ -61,7 +59,7 @@ import org.hibernate.type.descriptor.WrapperOptionsContext;
|
|||
*
|
||||
* @author Sanne Grinovero <sanne@hibernate.org> (C) 2012 Red Hat Inc.
|
||||
*/
|
||||
public class SessionDelegatorBaseImpl implements SessionImplementor, Session, WrapperOptionsContext {
|
||||
public class SessionDelegatorBaseImpl implements SessionImplementor, Session {
|
||||
|
||||
protected final SessionImplementor sessionImplementor;
|
||||
protected final Session session;
|
||||
|
@ -783,14 +781,6 @@ public class SessionDelegatorBaseImpl implements SessionImplementor, Session, Wr
|
|||
|
||||
@Override
|
||||
public WrapperOptions getWrapperOptions() {
|
||||
if ( sessionImplementor instanceof WrapperOptionsContext ) {
|
||||
return ( (WrapperOptionsContext) sessionImplementor ).getWrapperOptions();
|
||||
}
|
||||
else if ( session instanceof WrapperOptionsContext ) {
|
||||
return ( (WrapperOptionsContext) session ).getWrapperOptions();
|
||||
}
|
||||
else {
|
||||
return new WrapperOptionsImpl( sessionImplementor );
|
||||
}
|
||||
return sessionImplementor.getWrapperOptions();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.hibernate.loader.custom.CustomQuery;
|
|||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.resource.transaction.TransactionCoordinator;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.descriptor.WrapperOptionsContext;
|
||||
|
||||
/**
|
||||
* Defines the internal contract between {@link org.hibernate.Session} / {@link org.hibernate.StatelessSession} and
|
||||
|
@ -38,7 +39,7 @@ import org.hibernate.type.Type;
|
|||
* @author Gavin King
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface SessionImplementor extends Serializable, LobCreationContext {
|
||||
public interface SessionImplementor extends Serializable, LobCreationContext, WrapperOptionsContext {
|
||||
/**
|
||||
* Match te method on {@link org.hibernate.Session} and {@link org.hibernate.StatelessSession}
|
||||
*
|
||||
|
|
|
@ -58,7 +58,6 @@ import org.hibernate.resource.transaction.TransactionCoordinatorBuilder.Transact
|
|||
import org.hibernate.resource.transaction.spi.TransactionStatus;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.WrapperOptionsContext;
|
||||
|
||||
/**
|
||||
* Functionality common to stateless and stateful sessions
|
||||
|
@ -66,7 +65,7 @@ import org.hibernate.type.descriptor.WrapperOptionsContext;
|
|||
* @author Gavin King
|
||||
*/
|
||||
public abstract class AbstractSessionImpl
|
||||
implements Serializable, SharedSessionContract, SessionImplementor, JdbcSessionOwner, TransactionCoordinatorOptions, WrapperOptionsContext {
|
||||
implements Serializable, SharedSessionContract, SessionImplementor, JdbcSessionOwner, TransactionCoordinatorOptions {
|
||||
|
||||
protected transient SessionFactoryImpl factory;
|
||||
private final String tenantIdentifier;
|
||||
|
|
|
@ -19,10 +19,8 @@ import org.hibernate.engine.jdbc.Size;
|
|||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.internal.WrapperOptionsImpl;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.WrapperOptionsContext;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
|
@ -230,8 +228,7 @@ public abstract class AbstractStandardBasicType<T>
|
|||
}
|
||||
|
||||
public final T nullSafeGet(ResultSet rs, String name, final SessionImplementor session) throws SQLException {
|
||||
final WrapperOptions options = getOptions(session);
|
||||
return nullSafeGet( rs, name, options );
|
||||
return nullSafeGet( rs, name, session.getWrapperOptions() );
|
||||
}
|
||||
|
||||
protected final T nullSafeGet(ResultSet rs, String name, WrapperOptions options) throws SQLException {
|
||||
|
@ -248,8 +245,7 @@ public abstract class AbstractStandardBasicType<T>
|
|||
Object value,
|
||||
int index,
|
||||
final SessionImplementor session) throws SQLException {
|
||||
final WrapperOptions options = getOptions(session);
|
||||
nullSafeSet( st, value, index, options );
|
||||
nullSafeSet( st, value, index, session.getWrapperOptions() );
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
|
@ -337,25 +333,19 @@ public abstract class AbstractStandardBasicType<T>
|
|||
|
||||
@Override
|
||||
public T extract(CallableStatement statement, int startIndex, final SessionImplementor session) throws SQLException {
|
||||
final WrapperOptions options = getOptions(session);
|
||||
return remapSqlTypeDescriptor( options ).getExtractor( javaTypeDescriptor ).extract(
|
||||
return remapSqlTypeDescriptor( session.getWrapperOptions() ).getExtractor( javaTypeDescriptor ).extract(
|
||||
statement,
|
||||
startIndex,
|
||||
options
|
||||
session.getWrapperOptions()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T extract(CallableStatement statement, String[] paramNames, final SessionImplementor session) throws SQLException {
|
||||
final WrapperOptions options = getOptions(session);
|
||||
return remapSqlTypeDescriptor( options ).getExtractor( javaTypeDescriptor ).extract( statement, paramNames, options );
|
||||
}
|
||||
|
||||
private WrapperOptions getOptions(final SessionImplementor session) {
|
||||
if ( session instanceof WrapperOptionsContext ) {
|
||||
return ( (WrapperOptionsContext) session ).getWrapperOptions();
|
||||
}
|
||||
|
||||
return new WrapperOptionsImpl( session );
|
||||
return remapSqlTypeDescriptor( session.getWrapperOptions() ).getExtractor( javaTypeDescriptor ).extract(
|
||||
statement,
|
||||
paramNames,
|
||||
session.getWrapperOptions()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue