Package org.hibernate.engine.spi
Interface SessionImplementor
- All Superinterfaces:
AutoCloseable
,EntityManager
,JavaType.CoercionContext
,JdbcSessionOwner
,LobCreationContext
,QueryProducer
,QueryProducerImplementor
,Serializable
,Session
,SharedSessionContract
,SharedSessionContractImplementor
,TransactionCoordinatorBuilder.Options
,WrapperOptions
- All Known Subinterfaces:
EventSource
- All Known Implementing Classes:
AbstractDelegateSessionImplementor
,SessionDelegatorBaseImpl
,SessionImpl
,ToOneDelegateSessionImplementor
Defines the "internal contract" between
Session
and other parts of Hibernate
including implementors of Type
, EntityPersister
,
and CollectionPersister
.
The Session
, via this interface and SharedSessionContractImplementor
,
implements:
-
JdbcSessionOwner
, and so the session also acts as the orchestrator of a "JDBC session", and may be used to construct aJdbcCoordinator
. -
TransactionCoordinatorBuilder.Options
, allowing the session to control the creation of theTransactionCoordinator
delegate when it is passed as an argument toTransactionCoordinatorBuilder.buildTransactionCoordinator(org.hibernate.resource.transaction.spi.TransactionCoordinatorOwner, org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder.Options)
-
LobCreationContext
, and so the session may act as the context for JDBC LOB instance creation. -
WrapperOptions
, and so the session may influence the process of binding and extracting values to and from JDBC, which is performed by implementors ofJdbcType
.
EventSource
which extends this interface,
providing a bridge to the event generation features of org.hibernate.event
.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hibernate.engine.jdbc.LobCreationContext
LobCreationContext.Callback<T>
-
Method Summary
Modifier and TypeMethodDescriptiondefault SessionImplementor
Cast this object toSessionImplementor
, if possible.default <C,
T> T callWithConnection
(ConnectionFunction<C, T> function) <T> RootGraphImplementor<T>
createEntityGraph
(Class<T> rootType) Create a new mutable instance ofEntityGraph
, with only a root node, allowing programmatic definition of the graph from scratch.createEntityGraph
(String graphName) Create a new mutable instance ofEntityGraph
, based on a predefined named entity graph, allowing customization of the graph, or returnnull
if there is no predefined graph with the given name.<T> QueryImplementor<T>
createQuery
(CriteriaSelect<T> selectQuery) void
Initiate a flush to force deletion of a re-persisted entity.void
Initiate a flush to force deletion of a re-persisted entity.Get theActionQueue
associated with this session.getEntityGraph
(String graphName) Obtain an immutable reference to a predefined named entity graph or returnnull
if there is no predefined graph with the given name.default SessionImplementor
Returns this object, fulfilling the contract ofWrapperOptions
.Get the session factory which created this session.instantiate
(EntityPersister persister, Object id) Instantiate the entity class of the givenEntityPersister
, initializing the new instance with the given identifier.default boolean
Does this object implementSessionImplementor
?void
lock
(String entityName, Object child, LockOptions lockOptions) Cascade the lock operation to the given child entity.default <C> void
runWithConnection
(ConnectionConsumer<C> action) Methods inherited from interface jakarta.persistence.EntityManager
close, contains, createNamedStoredProcedureQuery, createNativeQuery, createNativeQuery, createNativeQuery, createStoredProcedureQuery, createStoredProcedureQuery, createStoredProcedureQuery, find, find, find, find, find, getCriteriaBuilder, getDelegate, getEntityManagerFactory, getLockMode, getMetamodel, getProperties, getTransaction, isJoinedToTransaction, isOpen, joinTransaction, lock, lock, lock, refresh, refresh, refresh, refresh, setProperty, unwrap
Methods inherited from interface org.hibernate.resource.jdbc.spi.JdbcSessionOwner
afterTransactionBegin, afterTransactionCompletion, beforeTransactionCompletion, flushBeforeTransactionCompletion, getEventManager, getEventMonitor, getJdbcBatchSize, getJdbcConnectionAccess, getJdbcSessionContext, getSqlExceptionHelper, getTransactionCoordinator, startTransactionBoundary
Methods inherited from interface org.hibernate.engine.jdbc.LobCreationContext
execute, fromContext
Methods inherited from interface org.hibernate.query.QueryProducer
createMutationQuery, createMutationQuery, createNamedSelectionQuery, createNamedSelectionQuery, createSelectionQuery, createSelectionQuery, createSelectionQuery
Methods inherited from interface org.hibernate.query.spi.QueryProducerImplementor
createMutationQuery, createMutationQuery, createMutationQuery, createNamedMutationQuery, createNamedQuery, createNamedQuery, createNativeMutationQuery, createNativeQuery, createNativeQuery, createNativeQuery, createNativeQuery, createNativeQuery, createQuery, createQuery, createQuery, createQuery, createQuery, createQuery, getCacheMode, getNamedNativeQuery, getNamedNativeQuery, getNamedQuery
Methods inherited from interface org.hibernate.Session
addEventListeners, byId, byId, byMultipleIds, byMultipleIds, byMultipleNaturalId, byMultipleNaturalId, byNaturalId, byNaturalId, bySimpleNaturalId, bySimpleNaturalId, cancelQuery, clear, contains, createNamedQuery, createNamedQuery, createQuery, createQuery, createQuery, createQuery, createQuery, createQuery, detach, disableFetchProfile, enableFetchProfile, evict, find, find, find, findMultiple, flush, get, get, get, get, get, get, getCacheMode, getCacheRetrieveMode, getCacheStoreMode, getCurrentLockMode, getEntityGraphs, getEntityName, getFetchBatchSize, getFlushMode, getHibernateFlushMode, getIdentifier, getLobHelper, getReference, getReference, getReference, getStatistics, isDefaultReadOnly, isDirty, isFetchProfileEnabled, isReadOnly, isSubselectFetchingEnabled, load, lock, lock, merge, merge, persist, persist, refresh, refresh, refresh, remove, replicate, replicate, sessionWithOptions, setCacheMode, setCacheRetrieveMode, setCacheStoreMode, setDefaultReadOnly, setFetchBatchSize, setFlushMode, setHibernateFlushMode, setReadOnly, setSubselectFetchingEnabled
Methods inherited from interface org.hibernate.SharedSessionContract
beginTransaction, close, createEntityGraph, createNamedStoredProcedureQuery, createStoredProcedureCall, createStoredProcedureCall, createStoredProcedureCall, createStoredProcedureQuery, createStoredProcedureQuery, createStoredProcedureQuery, disableFilter, doReturningWork, doWork, enableFilter, getCriteriaBuilder, getEnabledFilter, getJdbcBatchSize, getNamedProcedureCall, getTenantIdentifier, getTenantIdentifierValue, getTransaction, isConnected, isJoinedToTransaction, isOpen, joinTransaction, setJdbcBatchSize
Methods inherited from interface org.hibernate.engine.spi.SharedSessionContractImplementor
accessTransaction, afterOperation, afterScrollOperation, asEventSource, asStatelessSession, autoFlushIfRequired, autoFlushIfRequired, autoPreFlush, bestGuessEntityName, bestGuessEntityName, checkOpen, checkOpen, checkTransactionNeededForUpdateOperation, flush, generateEntityKey, getCacheTransactionSynchronization, getConfiguredJdbcBatchSize, getContextEntityIdentifier, getDialect, getEntityPersister, getEntityUsingInterceptor, getEventListenerManager, getExceptionConverter, getFactory, getFlushMode, getHibernateFlushMode, getInterceptor, getJdbcCoordinator, getJdbcServices, getLoadQueryInfluencers, getNativeJdbcParametersIgnored, getPersistenceContext, getPersistenceContextInternal, getSessionIdentifier, getSessionToken, getTypeConfiguration, guessEntityName, immediateLoad, initializeCollection, instantiate, internalLoad, isAutoCloseSessionEnabled, isClosed, isCriteriaCopyTreeEnabled, isDefaultReadOnly, isEventSource, isOpenOrWaitingForAutoClose, isStatelessSession, isTransactionInProgress, markForRollbackOnly, prepareForQueryExecution, setAutoClear, setCriteriaCopyTreeEnabled, setHibernateFlushMode, setNativeJdbcParametersIgnored, shouldAutoClose
Methods inherited from interface org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder.Options
shouldAutoJoinTransaction
Methods inherited from interface org.hibernate.type.descriptor.WrapperOptions
getJdbcTimeZone, getJsonFormatMapper, getLobCreator, getPreferredSqlTypeCodeForBoolean, getXmlFormatMapper, useStreamForLobBinding
-
Method Details
-
getSession
Description copied from interface:SharedSessionContractImplementor
Returns this object, fulfilling the contract ofWrapperOptions
.- Specified by:
getSession
in interfaceSharedSessionContractImplementor
- Specified by:
getSession
in interfaceWrapperOptions
-
getSessionFactory
SessionFactoryImplementor getSessionFactory()Description copied from interface:Session
Get the session factory which created this session.- Specified by:
getSessionFactory
in interfaceSession
- Specified by:
getSessionFactory
in interfaceSharedSessionContractImplementor
- Specified by:
getSessionFactory
in interfaceWrapperOptions
- Returns:
- the session factory
- See Also:
-
createEntityGraph
Description copied from interface:Session
Create a new mutable instance ofEntityGraph
, with only a root node, allowing programmatic definition of the graph from scratch.- Specified by:
createEntityGraph
in interfaceEntityManager
- Specified by:
createEntityGraph
in interfaceSession
- Specified by:
createEntityGraph
in interfaceSharedSessionContract
- Parameters:
rootType
- The root entity of the graph- See Also:
-
createEntityGraph
Description copied from interface:Session
Create a new mutable instance ofEntityGraph
, based on a predefined named entity graph, allowing customization of the graph, or returnnull
if there is no predefined graph with the given name.- Specified by:
createEntityGraph
in interfaceEntityManager
- Specified by:
createEntityGraph
in interfaceSession
- Specified by:
createEntityGraph
in interfaceSharedSessionContract
- Parameters:
graphName
- The name of the predefined named entity graph- See Also:
-
getEntityGraph
Description copied from interface:Session
Obtain an immutable reference to a predefined named entity graph or returnnull
if there is no predefined graph with the given name.- Specified by:
getEntityGraph
in interfaceEntityManager
- Specified by:
getEntityGraph
in interfaceSession
- Specified by:
getEntityGraph
in interfaceSharedSessionContract
- Parameters:
graphName
- The name of the predefined named entity graph- See Also:
-
createQuery
- Specified by:
createQuery
in interfaceEntityManager
-
getActionQueue
ActionQueue getActionQueue()Get theActionQueue
associated with this session. -
instantiate
Description copied from interface:SharedSessionContractImplementor
Instantiate the entity class of the givenEntityPersister
, initializing the new instance with the given identifier.This is more efficient than
SharedSessionContractImplementor.instantiate(String, Object)
, but not always interchangeable, since a single persister might be responsible for multiple types.- Specified by:
instantiate
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
forceFlush
Initiate a flush to force deletion of a re-persisted entity.- Throws:
HibernateException
-
forceFlush
Initiate a flush to force deletion of a re-persisted entity.- Throws:
HibernateException
-
lock
Cascade the lock operation to the given child entity. -
asSessionImplementor
Description copied from interface:SharedSessionContractImplementor
Cast this object toSessionImplementor
, if possible.- Specified by:
asSessionImplementor
in interfaceSharedSessionContractImplementor
-
isSessionImplementor
default boolean isSessionImplementor()Description copied from interface:SharedSessionContractImplementor
Does this object implementSessionImplementor
?- Specified by:
isSessionImplementor
in interfaceSharedSessionContractImplementor
-
runWithConnection
- Specified by:
runWithConnection
in interfaceEntityManager
-
callWithConnection
- Specified by:
callWithConnection
in interfaceEntityManager
-