Top Description Fields Constructors Methods
org.hibernate.internal

public abstract Class AbstractSharedSessionContract

extends Object
implements SharedSessionContractImplementor
Class Inheritance
All Implemented Interfaces
org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.query.spi.QueryProducerImplementor, org.hibernate.query.QueryProducer, org.hibernate.type.descriptor.WrapperOptions, org.hibernate.engine.jdbc.LobCreationContext, org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder.Options, org.hibernate.resource.jdbc.spi.JdbcSessionOwner, org.hibernate.SharedSessionContract, java.io.Serializable
Known Direct Subclasses
org.hibernate.internal.StatelessSessionImpl, org.hibernate.internal.AbstractSessionImpl
Annotations
@SuppressWarnings:WeakerAccess
Imports
java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .Serializable, java.sql.SQLException, java.util.List, .TimeZone, .UUID, javax.persistence.FlushModeType, .TransactionRequiredException, .Tuple, javax.persistence.criteria.CriteriaDelete, .CriteriaQuery, .CriteriaUpdate, .Selection, org.hibernate.AssertionFailure, .CacheMode, .EmptyInterceptor, .EntityNameResolver, .FlushMode, .Hibernate, .HibernateException, .Interceptor, .LockMode, .MultiTenancyStrategy, .SessionEventListener, .SessionException, .Transaction, org.hibernate.boot.registry.classloading.spi.ClassLoadingException, org.hibernate.cache.spi.CacheTransactionSynchronization, org.hibernate.engine.ResultSetMappingDefinition, org.hibernate.engine.internal.SessionEventListenerManagerImpl, org.hibernate.engine.jdbc.LobCreationContext, .LobCreator, org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess, org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl, org.hibernate.engine.jdbc.spi.JdbcCoordinator, .JdbcServices, org.hibernate.engine.query.spi.HQLQueryPlan, .NativeSQLQueryPlan, org.hibernate.engine.query.spi.sql.NativeSQLQueryConstructorReturn, .NativeSQLQueryReturn, .NativeSQLQueryRootReturn, .NativeSQLQuerySpecification, org.hibernate.engine.spi.EntityKey, .ExceptionConverter, .NamedQueryDefinition, .NamedSQLQueryDefinition, .QueryParameters, .SessionEventListenerManager, .SessionFactoryImplementor, .SharedSessionContractImplementor, org.hibernate.engine.transaction.internal.TransactionImpl, org.hibernate.engine.transaction.spi.TransactionImplementor, org.hibernate.id.uuid.StandardRandomStrategy, org.hibernate.jdbc.ReturningWork, .Work, .WorkExecutorVisitable, org.hibernate.jpa.QueryHints, org.hibernate.jpa.internal.util.FlushModeTypeHelper, org.hibernate.jpa.spi.CriteriaQueryTupleTransformer, .HibernateEntityManagerImplementor, .NativeQueryTupleTransformer, .TupleBuilderTransformer, org.hibernate.persister.entity.EntityPersister, org.hibernate.procedure.ProcedureCall, .ProcedureCallMemento, org.hibernate.procedure.internal.ProcedureCallImpl, org.hibernate.query.ParameterMetadata, .Query, org.hibernate.query.criteria.internal.compile.CompilableCriteria, .CriteriaCompiler, org.hibernate.query.criteria.internal.expression.CompoundSelectionImpl, org.hibernate.query.internal.NativeQueryImpl, .QueryImpl, org.hibernate.query.spi.NativeQueryImplementor, .QueryImplementor, .ScrollableResultsImplementor, org.hibernate.resource.jdbc.spi.JdbcSessionContext, .PhysicalConnectionHandlingMode, .StatementInspector, org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl, org.hibernate.resource.transaction.spi.TransactionCoordinator, .TransactionCoordinatorBuilder, org.hibernate.type.Type, org.hibernate.type.descriptor.sql.SqlTypeDescriptor

Base class for SharedSessionContract/SharedSessionContractImplementor implementations. Intended for Session and StatelessSession implementations

NOTE: This implementation defines access to a number of instance state values in a manner that is not exactly concurrent-access safe. However, a Session/EntityManager is never intended to be used concurrently; therefore the condition is not expected and so a more synchronized/concurrency-safe is not defined to be as negligent (performance-wise) as possible. Some of these methods include:

Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private boolean
private CacheMode
private transient CacheTransactionSynchronization
protected boolean
private final PhysicalConnectionHandlingMode
private CriteriaCompiler
private transient TransactionImplementor
private transient EntityNameResolver
private transient ExceptionConverter
private transient SessionFactoryImpl
factory

Deprecated as a consequence of SessionFactoryImpl being deprecated.
protected transient FastSessionServices
private FlushMode
private final Interceptor
private final boolean
private Integer
private transient JdbcConnectionAccess
private transient JdbcCoordinator
private transient JdbcSessionContext
private final TimeZone
private static final EntityManagerMessageLogger
private transient SessionEventListenerManagerImpl
private UUID
private final String
private transient TransactionCoordinator
protected boolean

Constructor Summary

AccessConstructor and Description
public
AbstractSharedSessionContract(SessionFactoryImpl factory, SessionCreationOptions options)

Deprecated as a consequence of SessionFactoryImpl being deprecated.

Method Summary

Modifier and TypeMethod and Description
public Transaction
accessTransaction()

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.accessTransaction.

Provides access to the underlying transaction or creates a new transaction if one does not already exist or is active.
protected void
public void
afterTransactionCompletion(boolean
Was the transaction successful?
successful
,
boolean
Is this a delayed after transaction completion call (aka after a timeout)?
delayed
)

Implements org.hibernate.resource.jdbc.spi.JdbcSessionOwner.afterTransactionCompletion.

An after-completion callback to the owner.
protected void
applyQuerySettingsAndHints(Query<R> query)

Deprecated as a consequence of Query being deprecated.
public void
public Transaction
beginTransaction()

Implements org.hibernate.SharedSessionContract.beginTransaction.

Begin a unit of work and return the associated Transaction object.
private IllegalArgumentException
buildIncompatibleException(Class<?> resultClass, Class<?> actualResultClass)

protected <T> QueryImplementor<T>
buildQueryFromName(String name, Class<T> resultType)

Deprecated as a consequence of QueryImplementor being deprecated.
public void
checkOpen(boolean markForRollbackIfClosed)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.checkOpen.

Performs a check whether the Session is open, and if not:
  • if markForRollbackIfClosed is true, marks current transaction (if one) for rollback only
  • throws an IllegalStateException (JPA defines the exception type)
protected void
public void
checkTransactionNeededForUpdateOperation(String
the message to use for the TransactionRequiredException
exceptionMessage
)

Overrides default org.hibernate.engine.spi.SharedSessionContractImplementor.checkTransactionNeededForUpdateOperation.

Check if an active Transaction is necessary for the update operation to be executed.
protected void
protected void
public void
close()

Implements org.hibernate.SharedSessionContract.close.

End the session by releasing the JDBC connection and cleaning up.
public QueryImplementor<R>
createNamedQuery(String
the name of a pre-defined, named query
name
)

Implements org.hibernate.query.QueryProducer.createNamedQuery, org.hibernate.query.spi.QueryProducerImplementor.createNamedQuery.

Deprecated as a consequence of QueryImplementor being deprecated.
The JPA-defined named query creation method.
public <R> QueryImplementor<R>
createNamedQuery(String
the name of a query defined in metadata
name
,
Class<R>
the type of the query result
resultClass
)

Implements org.hibernate.query.QueryProducer.createNamedQuery, org.hibernate.query.spi.QueryProducerImplementor.createNamedQuery.

Deprecated as a consequence of QueryImplementor being deprecated.
The JPA-defined named, typed query creation method.
private NativeQueryImplementor<T>
createNativeQuery(NamedSQLQueryDefinition queryDefinition, boolean isOrdinalParameterZeroBased)

Deprecated as a consequence of NativeQueryImplementor being deprecated.
protected <T> NativeQueryImplementor<T>
createNativeQuery(NamedSQLQueryDefinition queryDefinition, Class<T> resultType)

Deprecated as a consequence of NativeQueryImplementor being deprecated.
public NativeQueryImplementor<T>
createNativeQuery(String
a native SQL query string
sqlString
)

Implements org.hibernate.query.QueryProducer.createNativeQuery, org.hibernate.query.spi.QueryProducerImplementor.createNativeQuery.

Deprecated as a consequence of NativeQueryImplementor being deprecated.
Create a NativeQuery instance for the given native (SQL) query
public NativeQueryImplementor<T>
createNativeQuery(String
Native (SQL) query string
sqlString
,
Class<T>
The Java entity type to map results to
resultClass
)

Implements org.hibernate.query.QueryProducer.createNativeQuery, org.hibernate.query.spi.QueryProducerImplementor.createNativeQuery.

Deprecated as a consequence of NativeQueryImplementor being deprecated.
Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.
public NativeQueryImplementor<T>
createNativeQuery(String
Native (SQL) query string
sqlString
,
String
The explicit (named) result mapping
resultSetMapping
)

Implements org.hibernate.query.QueryProducer.createNativeQuery, org.hibernate.query.spi.QueryProducerImplementor.createNativeQuery.

Deprecated as a consequence of NativeQueryImplementor being deprecated.
Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.
protected QueryImpl<R>
createQuery(NamedQueryDefinition queryDefinition)

Deprecated as a consequence of QueryImpl being deprecated.
public QueryImpl<R>
createQuery(String
The HQL/JPQL query
queryString
)

Implements org.hibernate.SharedSessionContract.createQuery, org.hibernate.query.spi.QueryProducerImplementor.createQuery.

Deprecated as a consequence of QueryImpl being deprecated.
Create a Query instance for the given HQL/JPQL query string.
public <T> QueryImplementor<T>
createQuery(CriteriaQuery<T> criteriaQuery)

Implements org.hibernate.query.QueryProducer.createQuery.

Deprecated as a consequence of QueryImplementor being deprecated.
public QueryImplementor<R>
createQuery(CriteriaUpdate<T> criteriaUpdate)

Implements org.hibernate.query.QueryProducer.createQuery.

Deprecated as a consequence of QueryImplementor being deprecated.
public QueryImplementor<R>
createQuery(CriteriaDelete<T> criteriaDelete)

Implements org.hibernate.query.QueryProducer.createQuery.

Deprecated as a consequence of QueryImplementor being deprecated.
public <T> QueryImplementor<T>
createQuery(String jpaqlString, Class<T> resultClass, Selection<X> selection, HibernateEntityManagerImplementor.QueryOptions queryOptions)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.createQuery.

Deprecated as a consequence of QueryImplementor being deprecated.
public <T> QueryImplementor<T>
createQuery(String
The HQL/JPQL query
queryString
,
Class<T>
The type of the query result
resultClass
)

Implements org.hibernate.query.QueryProducer.createQuery, org.hibernate.query.spi.QueryProducerImplementor.createQuery.

Deprecated as a consequence of QueryImplementor being deprecated.
Create a typed Query instance for the given HQL/JPQL query string.
protected <T> QueryImplementor<T>
createQuery(NamedQueryDefinition namedQueryDefinition, Class<T> resultType)

Deprecated as a consequence of QueryImplementor being deprecated.
public NativeQueryImplementor<T>
createSQLQuery(String
The SQL query
queryString
)

Overrides default org.hibernate.query.QueryProducer.createSQLQuery, org.hibernate.query.spi.QueryProducerImplementor.createSQLQuery.

Deprecated as a consequence of NativeQueryImplementor being deprecated.
Create a NativeQuery instance for the given SQL query string.
public ProcedureCall
createStoredProcedureCall(String
The name of the procedure.
procedureName
)

Implements org.hibernate.SharedSessionContract.createStoredProcedureCall.

Deprecated as a consequence of ProcedureCall being deprecated.
Creates a call to a stored procedure.
public ProcedureCall
createStoredProcedureCall(String
The name of the procedure.
procedureName
,
Class<T>...
The entity(s) to map the result on to.
resultClasses
)

Implements org.hibernate.SharedSessionContract.createStoredProcedureCall.

Deprecated as a consequence of ProcedureCall being deprecated.
Creates a call to a stored procedure with specific result set entity mappings.
public ProcedureCall
createStoredProcedureCall(String
The name of the procedure.
procedureName
,
String...
The explicit result set mapping(s) to use for mapping the results
resultSetMappings
)

Implements org.hibernate.SharedSessionContract.createStoredProcedureCall.

Deprecated as a consequence of ProcedureCall being deprecated.
Creates a call to a stored procedure with specific result set entity mappings.
protected CriteriaCompiler
protected void
public <T> T
doReturningWork(final ReturningWork<T>
The work to be performed.
work
)

Overrides default org.hibernate.SharedSessionContract.doReturningWork.

Controller for allowing users to perform JDBC related work using the Connection managed by this Session.
public void
doWork(final Work
The work to be performed.
work
)

Overrides default org.hibernate.SharedSessionContract.doWork.

Controller for allowing users to perform JDBC related work using the Connection managed by this Session.
private <T> T
protected void
errorIfClosed()

Deprecated (since 5.2) use checkOpen() instead
public <T> T
execute(final LobCreationContext.Callback<T>
The callback to execute .
callback
)

Implements org.hibernate.engine.jdbc.LobCreationContext.execute.

Execute the given callback, making sure it has access to a viable JDBC Connection.
public EntityKey
generateEntityKey(Serializable
The entity id
id
,
EntityPersister
The entity persister
persister
)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.generateEntityKey.

Hide the changing requirements of entity key creation
public CacheMode
public CacheTransactionSynchronization
public Integer
getConfiguredJdbcBatchSize()

Overrides default org.hibernate.engine.spi.SharedSessionContractImplementor.getConfiguredJdbcBatchSize.

Override the implementation provided on SharedSessionContractImplementor which is not very efficient: this method is hot in Hibernate Reactive, and could be hot in some ORM contexts as well.
protected TransactionImplementor
public EntityNameResolver
public SessionEventListenerManager
public ExceptionConverter
getExceptionConverter()

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.getExceptionConverter.

The converter associated to a Session might be lazily initialized: only invoke this getter when there is actual need to use it.
public SessionFactoryImplementor
getFactory()

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.getFactory.

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Get the creating SessionFactoryImplementor
public FlushModeType
public FlushMode
public Interceptor
getInterceptor()

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.getInterceptor.

Retrieves the interceptor currently in use by this event source.
public Integer
public JdbcConnectionAccess
public JdbcCoordinator
public JdbcServices
public JdbcSessionContext
public TimeZone
getJdbcTimeZone()

Implements org.hibernate.type.descriptor.WrapperOptions.getJdbcTimeZone.

The JDBC TimeZone used when persisting Timestamp and DateTime properties into the database.
public LobCreator
public NativeQueryImplementor<T>
getNamedNativeQuery(String
The name of the pre-defined query
name
)

Implements org.hibernate.query.QueryProducer.getNamedNativeQuery, org.hibernate.query.spi.QueryProducerImplementor.getNamedNativeQuery.

Deprecated as a consequence of NativeQueryImplementor being deprecated.
Get a NativeQuery instance for a named native SQL query
public ProcedureCall
getNamedProcedureCall(String
The name given to the template
name
)

Implements org.hibernate.SharedSessionContract.getNamedProcedureCall.

Deprecated as a consequence of ProcedureCall being deprecated.
Gets a ProcedureCall based on a named template
public QueryImplementor<R>
getNamedQuery(String
the name of a pre-defined, named query
name
)

Implements org.hibernate.SharedSessionContract.getNamedQuery, org.hibernate.query.spi.QueryProducerImplementor.getNamedQuery.

Deprecated as a consequence of QueryImplementor being deprecated.
Create a Query instance for the named query.
public NativeQueryImplementor<T>
getNamedSQLQuery(String
The name of the pre-defined query
name
)

Overrides default org.hibernate.query.QueryProducer.getNamedSQLQuery, org.hibernate.query.spi.QueryProducerImplementor.getNamedSQLQuery.

Deprecated as a consequence of NativeQueryImplementor being deprecated.
Get a NativeQuery instance for a named native SQL query
private NativeQueryImplementor<T>
getNativeQueryImplementor(NamedSQLQueryDefinition queryDefinition, ParameterMetadata parameterMetadata)

Deprecated as a consequence of NativeQueryImplementor being deprecated.
protected NativeQueryImplementor<T>
getNativeQueryImplementor(String queryString, boolean isOrdinalParameterZeroBased)

Deprecated as a consequence of NativeQueryImplementor being deprecated.
protected NativeSQLQueryPlan
protected HQLQueryPlan
getQueryPlan(String query, boolean shallow)

public UUID
public String
public Transaction
getTransaction()

Implements org.hibernate.SharedSessionContract.getTransaction.

Get the Transaction instance associated with this session.
public TransactionCoordinator
getTransactionCoordinator()

Implements org.hibernate.resource.jdbc.spi.JdbcSessionOwner.getTransactionCoordinator.

Obtain the builder for TransactionCoordinator instances
public long
getTransactionStartTimestamp()

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.getTransactionStartTimestamp.

A "timestamp" at or before the start of the current transaction.
private void
handleNativeQueryResult(NativeQueryImplementor<T> query, Class<T> resultClass)

Deprecated as a consequence of NativeQueryImplementor being deprecated.
protected void
initQueryFromNamedDefinition(Query<R> query, NamedQueryDefinition nqd)

Deprecated as a consequence of Query being deprecated.
private Interceptor
interpret(Interceptor interceptor)

private StatementInspector
interpret(StatementInspector statementInspector)

public boolean
isClosed()

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.isClosed.

Checks whether the session is closed.
public boolean
isConnected()

Implements org.hibernate.SharedSessionContract.isConnected.

Check if the session is currently connected.
public boolean
isOpen()

Implements org.hibernate.SharedSessionContract.isOpen.

Check if the session is still open.
public boolean
isOpenOrWaitingForAutoClose()

Overrides default org.hibernate.engine.spi.SharedSessionContractImplementor.isOpenOrWaitingForAutoClose.

Checks whether the session is open or is waiting for auto-close
public boolean
isTransactionInProgress()

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.isTransactionInProgress.

Does this Session have an active Hibernate transaction or is there a JTA transaction in progress?
public List<E>
list(NativeSQLQuerySpecification
The specification of the native SQL query to execute.
spec
,
QueryParameters
The parameters by which to perform the execution.
queryParameters
)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.list.

Execute a native SQL query, and return the results as a fully built list.
protected abstract Object
load(String entityName, Serializable identifier)

public void
markForRollbackOnly()

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.markForRollbackOnly.

Marks current transaction (if one) for rollback only
protected void
protected void
private void
public SqlTypeDescriptor
remapSqlTypeDescriptor(SqlTypeDescriptor
The known descriptor
sqlTypeDescriptor
)

Implements org.hibernate.type.descriptor.WrapperOptions.remapSqlTypeDescriptor.

Allow remapping of descriptors for dealing with sql type.
protected void
protected void
resultClassChecking(Class<T> resultClass, QueryImpl<R> hqlQuery)

Deprecated as a consequence of QueryImpl being deprecated.
protected void
resultClassChecking(Class<T> resultType, NamedSQLQueryDefinition namedQueryDefinition)

public ScrollableResultsImplementor
scroll(NativeSQLQuerySpecification
The specification of the native SQL query to execute.
spec
,
QueryParameters
The parameters by which to perform the execution.
queryParameters
)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.scroll.

Execute a native SQL query, and return the results as a scrollable result.
public void
protected void
public void
setFlushMode(FlushMode
the new flush mode
flushMode
)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.setFlushMode.

Set the flush mode for this session.
public void
setHibernateFlushMode(FlushMode
the new flush mode
flushMode
)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.setHibernateFlushMode.

Set the flush mode for this session.
public void
setJdbcBatchSize(Integer
Session-level JDBC batch size
jdbcBatchSize
)

Implements org.hibernate.SharedSessionContract.setJdbcBatchSize.

Set the Session-level JDBC batch size.
public boolean
shouldAutoJoinTransaction()

Implements org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder.Options.shouldAutoJoinTransaction.

Indicates whether an active transaction should be automatically joined.
protected boolean
shouldCloseJdbcCoordinatorOnClose(boolean isTransactionCoordinatorShared)

public void
startTransactionBoundary()

Implements org.hibernate.resource.jdbc.spi.JdbcSessionOwner.startTransactionBoundary.

Callback indicating recognition of entering into a transactional context whether that is explicitly via the Hibernate org.hibernate.Transaction API or via registration of Hibernate's JTA Synchronization impl with a JTA Transaction
public boolean
useStreamForLobBinding()

Implements org.hibernate.type.descriptor.WrapperOptions.useStreamForLobBinding.

Should streams be used for binding LOB values.
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait