Package org.hibernate.engine.spi
Interface SessionImplementor
- All Superinterfaces:
AutoCloseable,Closeable,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 theTransactionCoordinatordelegate 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.- Author:
- Gavin King, Steve Ebersole
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hibernate.engine.jdbc.LobCreationContext
LobCreationContext.Callback<T>Nested classes/interfaces inherited from interface org.hibernate.Session
Session.LockRequest -
Method Summary
Modifier and TypeMethodDescriptiondefault SessionImplementorCast this object toSessionImplementor, if possible.<T> RootGraphImplementor<T>createEntityGraph(Class<T> rootType) Create a new mutableEntityGraphwith only a root node.createEntityGraph(String graphName) Create a new mutable copy of the namedEntityGraph, or returnnullif there is no graph with the given name.voiddelete(String entityName, Object child, boolean isCascadeDeleteEnabled, DeleteContext transientEntities) Deprecated.OperationalContext should cover this overload I believevoidInitiate a flush to force deletion of a re-persisted entity.voidInitiate a flush to force deletion of a re-persisted entity.Get theActionQueueassociated with this session.getEntityGraph(String graphName) Retrieve the namedEntityGraphas an immutable graph, or returnnullif there is no graph with the given name.default SessionImplementorReturns 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 booleanDoes this object implementSessionImplementor?voidlock(String entityName, Object child, LockOptions lockOptions) Cascade the lock operation to the given child entity.voidmerge(String entityName, Object object, MergeContext copiedAlready) Deprecated.OperationalContext should cover this overload I believevoidpersist(String entityName, Object object, PersistContext createdAlready) Deprecated.OperationalContext should cover this overload I believevoidpersistOnFlush(String entityName, Object object, PersistContext copiedAlready) Deprecated.OperationalContext should cover this overload I believevoidrefresh(String entityName, Object object, RefreshContext refreshedAlready) Deprecated.OperationalContext should cover this overload I believevoidremoveOrphanBeforeUpdates(String entityName, Object child) Deprecated.OperationalContext should cover this overload I believeMethods inherited from interface jakarta.persistence.EntityManager
close, contains, createNamedStoredProcedureQuery, createNativeQuery, createNativeQuery, createNativeQuery, createStoredProcedureQuery, createStoredProcedureQuery, createStoredProcedureQuery, find, find, find, find, getCriteriaBuilder, getDelegate, getEntityManagerFactory, getLockMode, getMetamodel, getProperties, getTransaction, isJoinedToTransaction, isOpen, joinTransaction, lock, lock, refresh, refresh, refresh, setProperty, unwrapMethods inherited from interface org.hibernate.resource.jdbc.spi.JdbcSessionOwner
afterTransactionBegin, afterTransactionCompletion, beforeTransactionCompletion, flushBeforeTransactionCompletion, getEventManager, getJdbcBatchSize, getJdbcConnectionAccess, getJdbcSessionContext, getSqlExceptionHelper, getTransactionCoordinator, startTransactionBoundaryMethods inherited from interface org.hibernate.engine.jdbc.LobCreationContext
execute, fromContextMethods inherited from interface org.hibernate.query.QueryProducer
createMutationQuery, createMutationQuery, createNamedSelectionQuery, createNamedSelectionQuery, createSelectionQuery, createSelectionQuery, createSelectionQueryMethods 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, getNamedNativeQuery, getNamedNativeQuery, getNamedQueryMethods inherited from interface org.hibernate.Session
addEventListeners, buildLockRequest, byId, byId, byMultipleIds, byMultipleIds, byMultipleNaturalId, byMultipleNaturalId, byNaturalId, byNaturalId, bySimpleNaturalId, bySimpleNaturalId, cancelQuery, clear, contains, createNamedQuery, createNamedQuery, createQuery, createQuery, createQuery, createQuery, createQuery, delete, delete, detach, disableFetchProfile, disableFilter, enableFetchProfile, enableFilter, evict, flush, get, get, get, get, get, get, getCacheMode, getCacheRetrieveMode, getCacheStoreMode, getCurrentLockMode, getEnabledFilter, getEntityGraphs, getEntityName, getFetchBatchSize, getFlushMode, getHibernateFlushMode, getIdentifier, getLobHelper, getReference, getReference, getReference, getStatistics, isDefaultReadOnly, isDirty, isFetchProfileEnabled, isReadOnly, isSubselectFetchingEnabled, load, load, load, load, load, load, load, lock, lock, lock, merge, merge, persist, persist, refresh, refresh, refresh, refresh, refresh, remove, replicate, replicate, save, save, saveOrUpdate, saveOrUpdate, sessionWithOptions, setCacheMode, setCacheRetrieveMode, setCacheStoreMode, setDefaultReadOnly, setFetchBatchSize, setFlushMode, setHibernateFlushMode, setReadOnly, setSubselectFetchingEnabled, update, updateMethods inherited from interface org.hibernate.SharedSessionContract
beginTransaction, close, createEntityGraph, createNamedStoredProcedureQuery, createStoredProcedureCall, createStoredProcedureCall, createStoredProcedureCall, createStoredProcedureQuery, createStoredProcedureQuery, createStoredProcedureQuery, doReturningWork, doWork, getCriteriaBuilder, getJdbcBatchSize, getNamedProcedureCall, getTenantIdentifier, getTenantIdentifierValue, getTransaction, isConnected, isJoinedToTransaction, isOpen, joinTransaction, setJdbcBatchSizeMethods inherited from interface org.hibernate.engine.spi.SharedSessionContractImplementor
accessTransaction, afterOperation, afterScrollOperation, asEventSource, asStatelessSession, autoFlushIfRequired, autoFlushIfRequired, autoPreFlush, bestGuessEntityName, bestGuessEntityName, checkOpen, checkOpen, checkTransactionNeededForUpdateOperation, flush, generateEntityKey, getCacheMode, getCacheTransactionSynchronization, getConfiguredJdbcBatchSize, getContextEntityIdentifier, 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, isEnforcingFetchGraph, isEventSource, isOpenOrWaitingForAutoClose, isStatelessSession, isTransactionInProgress, markForRollbackOnly, prepareForQueryExecution, setAutoClear, setCacheMode, setCriteriaCopyTreeEnabled, setEnforcingFetchGraph, setHibernateFlushMode, setNativeJdbcParametersIgnored, shouldAutoCloseMethods inherited from interface org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder.Options
shouldAutoJoinTransactionMethods inherited from interface org.hibernate.type.descriptor.WrapperOptions
getDialect, getJdbcTimeZone, getLobCreator, getPreferredSqlTypeCodeForBoolean, useStreamForLobBinding
-
Method Details
-
getSession
Description copied from interface:SharedSessionContractImplementorReturns this object, fulfilling the contract ofWrapperOptions.- Specified by:
getSessionin interfaceSharedSessionContractImplementor- Specified by:
getSessionin interfaceWrapperOptions
-
getSessionFactory
SessionFactoryImplementor getSessionFactory()Description copied from interface:SessionGet the session factory which created this session.- Specified by:
getSessionFactoryin interfaceSession- Specified by:
getSessionFactoryin interfaceSharedSessionContractImplementor- Specified by:
getSessionFactoryin interfaceWrapperOptions- Returns:
- the session factory
- See Also:
-
createEntityGraph
Description copied from interface:SharedSessionContractCreate a new mutableEntityGraphwith only a root node.- Specified by:
createEntityGraphin interfaceEntityManager- Specified by:
createEntityGraphin interfaceSession- Specified by:
createEntityGraphin interfaceSharedSessionContract- Parameters:
rootType- the root entity class of the graph- Returns:
- entity graph
-
createEntityGraph
Description copied from interface:SharedSessionContractCreate a new mutable copy of the namedEntityGraph, or returnnullif there is no graph with the given name.- Specified by:
createEntityGraphin interfaceEntityManager- Specified by:
createEntityGraphin interfaceSession- Specified by:
createEntityGraphin interfaceSharedSessionContract- Parameters:
graphName- the name of the graph- Returns:
- entity graph
- See Also:
-
getEntityGraph
Description copied from interface:SharedSessionContractRetrieve the namedEntityGraphas an immutable graph, or returnnullif there is no graph with the given name.- Specified by:
getEntityGraphin interfaceEntityManager- Specified by:
getEntityGraphin interfaceSession- Specified by:
getEntityGraphin interfaceSharedSessionContract- Parameters:
graphName- the name of the graph- Returns:
- named entity graph
- See Also:
-
getActionQueue
ActionQueue getActionQueue()Get theActionQueueassociated with this session. -
instantiate
Description copied from interface:SharedSessionContractImplementorInstantiate 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:
instantiatein 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. -
merge
@Deprecated void merge(String entityName, Object object, MergeContext copiedAlready) throws HibernateException Deprecated.OperationalContext should cover this overload I believe- Throws:
HibernateException
-
persist
@Deprecated void persist(String entityName, Object object, PersistContext createdAlready) throws HibernateException Deprecated.OperationalContext should cover this overload I believe- Throws:
HibernateException
-
persistOnFlush
Deprecated.OperationalContext should cover this overload I believe -
refresh
@Deprecated void refresh(String entityName, Object object, RefreshContext refreshedAlready) throws HibernateException Deprecated.OperationalContext should cover this overload I believe- Throws:
HibernateException
-
delete
@Deprecated void delete(String entityName, Object child, boolean isCascadeDeleteEnabled, DeleteContext transientEntities) Deprecated.OperationalContext should cover this overload I believe -
removeOrphanBeforeUpdates
Deprecated.OperationalContext should cover this overload I believe -
asSessionImplementor
Description copied from interface:SharedSessionContractImplementorCast this object toSessionImplementor, if possible.- Specified by:
asSessionImplementorin interfaceSharedSessionContractImplementor
-
isSessionImplementor
default boolean isSessionImplementor()Description copied from interface:SharedSessionContractImplementorDoes this object implementSessionImplementor?- Specified by:
isSessionImplementorin interfaceSharedSessionContractImplementor
-