Class SessionImpl
- java.lang.Object
-
- org.hibernate.internal.AbstractSharedSessionContract
-
- org.hibernate.internal.SessionImpl
-
- All Implemented Interfaces:
jakarta.persistence.EntityManager
,Closeable
,Serializable
,AutoCloseable
,LobCreationContext
,SessionImplementor
,SharedSessionContractImplementor
,EventSource
,LoadAccessContext
,QueryProducer
,QueryProducerImplementor
,JdbcSessionOwner
,TransactionCoordinatorBuilder.Options
,Session
,SharedSessionContract
,JavaType.CoercionContext
,WrapperOptions
public class SessionImpl extends AbstractSharedSessionContract implements Serializable, SharedSessionContractImplementor, JdbcSessionOwner, SessionImplementor, EventSource, TransactionCoordinatorBuilder.Options, WrapperOptions, LoadAccessContext
Concrete implementation of theSession
API. Exposes two interfaces:Session
to the applicationSessionImplementor
andEventSource
to other Hibernate components (SPI)
- See Also:
- Serialized Form
-
-
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
-
-
Field Summary
-
Fields inherited from class org.hibernate.internal.AbstractSharedSessionContract
closed, fastSessionServices, waitingForAutoClose
-
-
Constructor Summary
Constructors Constructor Description SessionImpl(SessionFactoryImpl factory, SessionCreationOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addEventListeners(SessionEventListener... listeners)
Add one or more listeners to the Sessionprotected void
addSharedSessionTransactionObserver(TransactionCoordinator transactionCoordinator)
void
afterOperation(boolean success)
Check if there is a Hibernate or JTA transaction in progress and, if there is not, flush if necessary, make sure the connection has been committed (if it is not in autocommit mode) and run the after completion processingvoid
afterScrollOperation()
void
afterTransactionBegin()
A after-begin callback from the coordinator to its owner.void
afterTransactionCompletion(boolean successful, boolean delayed)
An after-completion callback to the owner.protected void
applyLockOptionsHint(SelectionQuery<?> query)
protected void
applyQuerySettingsAndHints(Query<?> query)
protected void
applyQuerySettingsAndHints(SelectionQuery<?> query)
boolean
autoFlushIfRequired(Set<String> querySpaces)
detect in-memory changes, determine if the changes are to tables named in the query and, if so, complete execution the flushvoid
beforeTransactionCompletion()
A before-completion callback to the owner.String
bestGuessEntityName(Object object)
The best guess entity name for an entity not in an associationSession.LockRequest
buildLockRequest(LockOptions lockOptions)
Build a newlock request
that specifies: theLockMode
to use, the pessimistic lock timeout, and the scope of the lock.<T> IdentifierLoadAccessImpl<T>
byId(Class<T> entityClass)
Create anIdentifierLoadAccess
instance to retrieve the specified entity by primary key.<T> IdentifierLoadAccessImpl<T>
byId(String entityName)
Create anIdentifierLoadAccess
instance to retrieve the specified entity type by primary key.<T> MultiIdentifierLoadAccess<T>
byMultipleIds(Class<T> entityClass)
Create aMultiIdentifierLoadAccess
instance to retrieve multiple entities at once as specified by primary key values.<T> MultiIdentifierLoadAccess<T>
byMultipleIds(String entityName)
Create aMultiIdentifierLoadAccess
instance to retrieve multiple entities at once as specified by primary key values.<T> NaturalIdMultiLoadAccess<T>
byMultipleNaturalId(Class<T> entityClass)
Access to load multiple entities bynatural id
.<T> NaturalIdMultiLoadAccess<T>
byMultipleNaturalId(String entityName)
Access to load multiple entities bynatural id
.<T> NaturalIdLoadAccess<T>
byNaturalId(Class<T> entityClass)
Create aNaturalIdLoadAccess
instance to retrieve the specified entity by its natural id.<T> NaturalIdLoadAccess<T>
byNaturalId(String entityName)
Create aNaturalIdLoadAccess
instance to retrieve the specified entity by its natural id.<T> SimpleNaturalIdLoadAccess<T>
bySimpleNaturalId(Class<T> entityClass)
Create aSimpleNaturalIdLoadAccess
instance to retrieve the specified entity by its simple (single attribute)natural id
.<T> SimpleNaturalIdLoadAccess<T>
bySimpleNaturalId(String entityName)
Create aSimpleNaturalIdLoadAccess
instance to retrieve the specified entity by itsnatural id
.void
cancelQuery()
Cancel the execution of the current query.protected void
checkNoUnresolvedActionsAfterOperation()
protected void
checkNoUnresolvedActionsBeforeOperation()
void
checkOpenOrWaitingForAutoClose()
Callback to check whether the session is "active"protected void
checkSessionFactoryOpen()
protected void
cleanupOnClose()
clear all the internal collections, just to help the garbage collector, does not clear anything that is needed during the afterTransactionCompletion() phasevoid
clear()
Completely clear the session.void
close()
End the session by releasing the JDBC connection and cleaning up.void
closeWithoutOpenChecks()
boolean
contains(Object object)
boolean
contains(String entityName, Object object)
Determine if the given entity is associated with this session.protected ActionQueue
createActionQueue()
<T> RootGraphImplementor<T>
createEntityGraph(Class<T> rootType)
RootGraphImplementor<?>
createEntityGraph(String graphName)
ProcedureCall
createNamedStoredProcedureQuery(String name)
Obtain aProcedureCall
based on a named templateprotected StatefulPersistenceContext
createPersistenceContext()
ProcedureCall
createStoredProcedureCall(String procedureName)
Create aProcedureCall
to a stored procedure.ProcedureCall
createStoredProcedureCall(String procedureName, Class<?>... resultClasses)
Create aProcedureCall
to a stored procedure with the given result set entity mappings.ProcedureCall
createStoredProcedureCall(String procedureName, String... resultSetMappings)
Create aProcedureCall
to a stored procedure with the given result set entity mappings.ProcedureCall
createStoredProcedureQuery(String procedureName)
Create aProcedureCall
to a stored procedure.ProcedureCall
createStoredProcedureQuery(String procedureName, Class... resultClasses)
Create aProcedureCall
to a stored procedure with the given result set entity mappings.ProcedureCall
createStoredProcedureQuery(String procedureName, String... resultSetMappings)
Create aProcedureCall
to a stored procedure with the given result set entity mappings.void
delayedAfterCompletion()
void
delete(Object object)
Deprecated.void
delete(String entityName, Object object)
Deprecated.void
delete(String entityName, Object object, boolean isCascadeDeleteEnabled, DeleteContext transientEntities)
Cascade delete an entity instancevoid
detach(Object entity)
Remove this instance from the session cache.protected CacheMode
determineAppropriateLocalCacheMode(Map<String,Object> localProperties)
void
disableFetchProfile(String name)
Disable a particular fetch profile on this session.void
disableFilter(String filterName)
Disable the named filter for the current session.void
enableFetchProfile(String name)
Enable a particular fetch profile on this session.Filter
enableFilter(String filterName)
Enable the named filter for this current session.void
evict(Object object)
remove any hard references to the entity that are held by the infrastructure (references held by application or other persistent instances are okay)<T> T
find(Class<T> entityClass, Object primaryKey)
<T> T
find(Class<T> entityClass, Object primaryKey, jakarta.persistence.LockModeType lockModeType)
<T> T
find(Class<T> entityClass, Object primaryKey, jakarta.persistence.LockModeType lockModeType, Map<String,Object> properties)
<T> T
find(Class<T> entityClass, Object primaryKey, Map<String,Object> properties)
void
fireLoad(LoadEvent event, LoadEventListener.LoadType loadType)
void
flush()
Force this session to flush.void
flushBeforeTransactionCompletion()
void
forceFlush(EntityEntry entityEntry)
Force an immediate flush<T> T
get(Class<T> entityClass, Object id)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.<T> T
get(Class<T> entityClass, Object id, LockMode lockMode)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.<T> T
get(Class<T> entityClass, Object id, LockOptions lockOptions)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.Object
get(String entityName, Object id)
Return the persistent instance of the given named entity with the given identifier, or null if there is no such persistent instance.Object
get(String entityName, Object id, LockMode lockMode)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.Object
get(String entityName, Object id, LockOptions lockOptions)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.ActionQueue
getActionQueue()
Get the ActionQueue for this sessionObject
getContextEntityIdentifier(Object object)
Get the id value for an object that is actually associated with the session.LockMode
getCurrentLockMode(Object object)
Determine the currentLockMode
of the given managed instance associated with this session.Object
getDelegate()
Filter
getEnabledFilter(String filterName)
Retrieve a currently enabled filter by name.RootGraphImplementor<?>
getEntityGraph(String graphName)
<T> List<jakarta.persistence.EntityGraph<? super T>>
getEntityGraphs(Class<T> entityClass)
SessionFactoryImplementor
getEntityManagerFactory()
String
getEntityName(Object object)
Return the entity name for a persistent entity.EntityPersister
getEntityPersister(String entityName, Object object)
Get theEntityPersister
for any instanceObject
getEntityUsingInterceptor(EntityKey key)
Get the entity instance associated with the givenKey
, calling the Interceptor if necessaryObject
getIdentifier(Object object)
Return the identifier value of the given entity associated with this session.LoadQueryInfluencers
getLoadQueryInfluencers()
Get the load query influencers associated with this session.LobHelper
getLobHelper()
Retrieve this session's helper/delegate for creating LOB instances.jakarta.persistence.LockModeType
getLockMode(Object entity)
jakarta.persistence.metamodel.Metamodel
getMetamodel()
PersistenceContext
getPersistenceContext()
Get the persistence context for this session.PersistenceContext
getPersistenceContextInternal()
This is similar toSharedSessionContractImplementor.getPersistenceContext()
, with two main differences: a) this version performs better as it allows for inlining and probably better prediction b) see SessionImplSharedSessionContractImplementor.getPersistenceContext()
: it does some checks on the current state of the Session.Map<String,Object>
getProperties()
<T> T
getReference(Class<T> entityClass, Object id)
Return a reference to the persistent instance with the given class and identifier, making the assumption that the instance is still persistent in the database.Object
getReference(String entityName, Object id)
Return a reference to the persistent instance of the given named entity with the given identifier, making the assumption that the instance is still persistent in the database.<T> T
getReference(T object)
Return a reference to the persistent instance with the same identity as the given instance, which might be detached, making the assumption that the instance is still persistent in the database.SessionImplementor
getSession()
Access to the current SessionSessionFactoryImplementor
getSessionFactory()
Access to the current SessionSessionStatistics
getStatistics()
Get the statistics for this session.String
guessEntityName(Object object)
The guessed entity name for an entity not in an associationObject
immediateLoad(String entityName, Object id)
Load the data for the object with the specified id into a newly created object.void
initializeCollection(PersistentCollection<?> collection, boolean writing)
Initialize the collection (if not already initialized)Object
instantiate(String entityName, Object id)
Instantiate the entity class, initializing with the given identifierObject
instantiate(EntityPersister persister, Object id)
give the interceptor an opportunity to override the default instantiationObject
internalLoad(String entityName, Object id, boolean eager, boolean nullable)
Load an instance without checking if it was deleted.boolean
isAutoCloseSessionEnabled()
boolean
isDefaultReadOnly()
Will entities and proxies that are loaded into this session be made read-only by default?boolean
isDirty()
Does this session contain any changes which must be synchronized with the database? In other words, would any DML operations be executed if we flushed this session?boolean
isEnforcingFetchGraph()
boolean
isEventSource()
boolean
isFetchProfileEnabled(String name)
Is a particular fetch profile enabled on this session?boolean
isJoinedToTransaction()
boolean
isOpen()
Check if the session is still open.boolean
isReadOnly(Object entityOrProxy)
Is the specified entity or proxy read-only?void
joinTransaction()
<T> T
load(Class<T> entityClass, Object id)
Deprecated.<T> T
load(Class<T> entityClass, Object id, LockMode lockMode)
Deprecated.<T> T
load(Class<T> entityClass, Object id, LockOptions lockOptions)
Deprecated.void
load(Object object, Object id)
Read the persistent state associated with the given identifier into the given transient instance.Object
load(String entityName, Object id)
Deprecated.Object
load(String entityName, Object id, LockMode lockMode)
Deprecated.Object
load(String entityName, Object id, LockOptions lockOptions)
Deprecated.void
lock(Object entity, jakarta.persistence.LockModeType lockModeType)
void
lock(Object entity, jakarta.persistence.LockModeType lockModeType, Map<String,Object> properties)
void
lock(Object object, LockMode lockMode)
Obtain the specified lock level on the given managed instance association with this session.void
lock(String entityName, Object object, LockMode lockMode)
Obtain the specified lock level on the given managed instance association with this session.void
merge(String entityName, Object object, MergeContext copiedAlready)
Cascade merge an entity instance<T> T
merge(String entityName, T object)
Copy the state of the given object onto the persistent object with the same identifier.<T> T
merge(T object)
Copy the state of the given object onto the persistent object with the same identifier.void
persist(Object object)
Make a transient instance persistent and mark it for later insertion in the database.void
persist(String entityName, Object object)
Make a transient instance persistent and mark it for later insertion in the database.void
persist(String entityName, Object object, PersistContext copiedAlready)
Cascade persist an entity instancevoid
persistOnFlush(String entityName, Object object, PersistContext copiedAlready)
Cascade persist an entity instance during the flush processvoid
pulseTransactionCoordinator()
Callback to pulse the transaction coovoid
refresh(Object object)
Reread the state of the given managed instance associated with this session from the underlying database.void
refresh(Object entity, jakarta.persistence.LockModeType lockModeType)
void
refresh(Object entity, jakarta.persistence.LockModeType lockModeType, Map<String,Object> properties)
void
refresh(Object entity, Map<String,Object> properties)
void
refresh(Object object, LockMode lockMode)
Reread the state of the given managed instance from the underlying database, obtaining the givenLockMode
.void
refresh(Object object, LockOptions lockOptions)
Reread the state of the given managed instance from the underlying database, obtaining the givenLockMode
.void
refresh(String entityName, Object object)
Deprecated.void
refresh(String entityName, Object object, RefreshContext refreshedAlready)
Cascade refresh an entity instancevoid
refresh(String entityName, Object object, LockOptions lockOptions)
Deprecated.void
remove(Object entity)
Mark a persistence instance associated with this session for removal from the underlying database.void
removeOrphanBeforeUpdates(String entityName, Object child)
A specialized type of deletion for orphan removal that must occur prior to queued inserts and updates.protected void
removeSharedSessionTransactionObserver(TransactionCoordinator transactionCoordinator)
void
replicate(Object obj, ReplicationMode replicationMode)
Persist the state of the given detached instance, reusing the current identifier value.void
replicate(String entityName, Object obj, ReplicationMode replicationMode)
Persist the state of the given detached instance, reusing the current identifier value.Object
save(Object obj)
Deprecated.Object
save(String entityName, Object object)
Deprecated.void
saveOrUpdate(Object object)
Deprecated.void
saveOrUpdate(String entityName, Object obj)
Deprecated.SharedSessionBuilder
sessionWithOptions()
Obtain aSession
builder with the ability to copy certain information from this session.void
setAutoClear(boolean enabled)
Enable/disable automatic cache clearing from after transaction completion (for EJB3)void
setDefaultReadOnly(boolean defaultReadOnly)
Change the default for entities and proxies loaded into this session from modifiable to read-only mode, or from modifiable to read-only mode.void
setEnforcingFetchGraph(boolean isEnforcingFetchGraph)
void
setFlushMode(jakarta.persistence.FlushModeType flushModeType)
Set the currentJPA flush mode
for this session.void
setProperty(String propertyName, Object value)
void
setReadOnly(Object entity, boolean readOnly)
Set an unmodified persistent object to read-only mode, or a read-only object to modifiable mode.boolean
shouldAutoClose()
protected boolean
shouldCloseJdbcCoordinatorOnClose(boolean isTransactionCoordinatorShared)
void
startTransactionBoundary()
Callback indicating recognition of entering into a transactional context whether that is explicitly via the HibernateTransaction
API or via registration of Hibernate's JTA Synchronization impl with a JTA TransactionString
toString()
<T> T
unwrap(Class<T> clazz)
void
update(Object obj)
Deprecated.void
update(String entityName, Object object)
Deprecated.-
Methods inherited from class org.hibernate.internal.AbstractSharedSessionContract
accessTransaction, beginTransaction, buildNamedQuery, buildNamedQuery, checkOpen, checkTransactionNeededForUpdateOperation, checkTransactionSynchStatus, createMutationQuery, createMutationQuery, createMutationQuery, createMutationQuery, createNamedMutationQuery, createNamedQuery, createNamedQuery, createNamedSelectionQuery, createNamedSelectionQuery, createNativeMutationQuery, createNativeQuery, createNativeQuery, createNativeQuery, createNativeQuery, createNativeQuery, createQuery, createQuery, createQuery, createQuery, createQuery, createSelectionQuery, createSelectionQuery, createSelectionQuery, doReturningWork, doWork, execute, generateEntityKey, getCacheMode, getCacheTransactionSynchronization, getConfiguredJdbcBatchSize, getCriteriaBuilder, getCurrentTransaction, getEntityNameResolver, getEventListenerManager, getExceptionConverter, getFactory, getFlushMode, getHibernateFlushMode, getInterceptor, getJdbcBatchSize, getJdbcConnectionAccess, getJdbcCoordinator, getJdbcServices, getJdbcSessionContext, getJdbcTimeZone, getLobCreator, getNamedNativeQuery, getNamedNativeQuery, getNamedProcedureCall, getNamedQuery, getPreferredSqlTypeCodeForBoolean, getSessionIdentifier, getSessionToken, getTenantIdentifier, getTransaction, getTransactionCoordinator, getTransactionStartTimestamp, isClosed, isConnected, isCriteriaCopyTreeEnabled, isOpenOrWaitingForAutoClose, isTransactionInProgress, markForRollbackOnly, prepareForAutoClose, prepareForQueryExecution, setCacheMode, setClosed, setCriteriaCopyTreeEnabled, setHibernateFlushMode, setJdbcBatchSize, shouldAutoJoinTransaction, useStreamForLobBinding
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jakarta.persistence.EntityManager
createNativeQuery, createNativeQuery, createNativeQuery, getCriteriaBuilder, getTransaction
-
Methods inherited from interface org.hibernate.resource.jdbc.spi.JdbcSessionOwner
getJdbcBatchSize, getJdbcConnectionAccess, getJdbcSessionContext, getTransactionCoordinator
-
Methods inherited from interface org.hibernate.engine.jdbc.LobCreationContext
execute
-
Methods inherited from interface org.hibernate.query.QueryProducer
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, getNamedNativeQuery, getNamedNativeQuery, getNamedQuery
-
Methods inherited from interface org.hibernate.Session
createNamedQuery, createNamedQuery, createQuery, createQuery, createQuery, createQuery, createQuery, getCacheMode, getFlushMode, getHibernateFlushMode, setCacheMode, setHibernateFlushMode
-
Methods inherited from interface org.hibernate.SharedSessionContract
beginTransaction, doReturningWork, doWork, getCriteriaBuilder, getJdbcBatchSize, getNamedProcedureCall, getTransaction, isConnected, setJdbcBatchSize
-
Methods inherited from interface org.hibernate.engine.spi.SharedSessionContractImplementor
accessTransaction, checkOpen, checkOpen, checkTransactionNeededForUpdateOperation, generateEntityKey, getCacheMode, getCacheTransactionSynchronization, getConfiguredJdbcBatchSize, getEventListenerManager, getExceptionConverter, getFactory, getFlushMode, getHibernateFlushMode, getInterceptor, getJdbcCoordinator, getJdbcServices, getSessionIdentifier, getSessionToken, getTenantIdentifier, getTransactionStartTimestamp, getTypeConfiguration, isClosed, isCriteriaCopyTreeEnabled, isOpenOrWaitingForAutoClose, isTransactionInProgress, markForRollbackOnly, prepareForQueryExecution, setCacheMode, setCriteriaCopyTreeEnabled, setHibernateFlushMode
-
Methods inherited from interface org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder.Options
shouldAutoJoinTransaction
-
Methods inherited from interface org.hibernate.type.descriptor.WrapperOptions
getJdbcTimeZone, getLobCreator, getPreferredSqlTypeCodeForBoolean, useStreamForLobBinding
-
-
-
-
Constructor Detail
-
SessionImpl
public SessionImpl(SessionFactoryImpl factory, SessionCreationOptions options)
-
-
Method Detail
-
createPersistenceContext
protected StatefulPersistenceContext createPersistenceContext()
-
createActionQueue
protected ActionQueue createActionQueue()
-
applyQuerySettingsAndHints
protected void applyQuerySettingsAndHints(SelectionQuery<?> query)
- Overrides:
applyQuerySettingsAndHints
in classAbstractSharedSessionContract
-
applyLockOptionsHint
protected void applyLockOptionsHint(SelectionQuery<?> query)
-
applyQuerySettingsAndHints
protected void applyQuerySettingsAndHints(Query<?> query)
- Overrides:
applyQuerySettingsAndHints
in classAbstractSharedSessionContract
-
sessionWithOptions
public SharedSessionBuilder sessionWithOptions()
Description copied from interface:Session
Obtain aSession
builder with the ability to copy certain information from this session.- Specified by:
sessionWithOptions
in interfaceSession
- Returns:
- the session builder
-
clear
public void clear()
Description copied from interface:Session
Completely clear the session. Evict all loaded instances and cancel all pending saves, updates and deletions. Do not close open iterators or instances ofScrollableResults
.
-
close
public void close() throws HibernateException
Description copied from interface:SharedSessionContract
End the session by releasing the JDBC connection and cleaning up.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfacejakarta.persistence.EntityManager
- Specified by:
close
in interfaceSharedSessionContract
- Overrides:
close
in classAbstractSharedSessionContract
- Throws:
HibernateException
- Indicates problems cleaning up.
-
closeWithoutOpenChecks
public void closeWithoutOpenChecks() throws HibernateException
- Throws:
HibernateException
-
shouldCloseJdbcCoordinatorOnClose
protected boolean shouldCloseJdbcCoordinatorOnClose(boolean isTransactionCoordinatorShared)
- Overrides:
shouldCloseJdbcCoordinatorOnClose
in classAbstractSharedSessionContract
-
isAutoCloseSessionEnabled
public boolean isAutoCloseSessionEnabled()
- Specified by:
isAutoCloseSessionEnabled
in interfaceSharedSessionContractImplementor
-
isOpen
public boolean isOpen()
Description copied from interface:SharedSessionContract
Check if the session is still open.- Specified by:
isOpen
in interfacejakarta.persistence.EntityManager
- Specified by:
isOpen
in interfaceSharedSessionContract
- Overrides:
isOpen
in classAbstractSharedSessionContract
- Returns:
- boolean
-
checkSessionFactoryOpen
protected void checkSessionFactoryOpen()
-
shouldAutoClose
public boolean shouldAutoClose()
- Specified by:
shouldAutoClose
in interfaceSharedSessionContractImplementor
-
setAutoClear
public void setAutoClear(boolean enabled)
Description copied from interface:SharedSessionContractImplementor
Enable/disable automatic cache clearing from after transaction completion (for EJB3)- Specified by:
setAutoClear
in interfaceSharedSessionContractImplementor
-
afterOperation
public void afterOperation(boolean success)
Description copied from interface:SharedSessionContractImplementor
Check if there is a Hibernate or JTA transaction in progress and, if there is not, flush if necessary, make sure the connection has been committed (if it is not in autocommit mode) and run the after completion processing- Specified by:
afterOperation
in interfaceLoadAccessContext
- Specified by:
afterOperation
in interfaceSharedSessionContractImplementor
- Parameters:
success
- Was the operation a success
-
addEventListeners
public void addEventListeners(SessionEventListener... listeners)
Description copied from interface:Session
Add one or more listeners to the Session- Specified by:
addEventListeners
in interfaceSession
- Parameters:
listeners
- the listener(s) to add
-
cleanupOnClose
protected void cleanupOnClose()
clear all the internal collections, just to help the garbage collector, does not clear anything that is needed during the afterTransactionCompletion() phase- Overrides:
cleanupOnClose
in classAbstractSharedSessionContract
-
getCurrentLockMode
public LockMode getCurrentLockMode(Object object) throws HibernateException
Description copied from interface:Session
Determine the currentLockMode
of the given managed instance associated with this session.- Specified by:
getCurrentLockMode
in interfaceSession
- Parameters:
object
- a persistent instance- Returns:
- the current lock mode
- Throws:
HibernateException
-
getEntityUsingInterceptor
public Object getEntityUsingInterceptor(EntityKey key) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Get the entity instance associated with the givenKey
, calling the Interceptor if necessary- Specified by:
getEntityUsingInterceptor
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
checkNoUnresolvedActionsBeforeOperation
protected void checkNoUnresolvedActionsBeforeOperation()
-
checkNoUnresolvedActionsAfterOperation
protected void checkNoUnresolvedActionsAfterOperation()
-
delayedAfterCompletion
public void delayedAfterCompletion()
- Specified by:
delayedAfterCompletion
in interfaceLoadAccessContext
- Overrides:
delayedAfterCompletion
in classAbstractSharedSessionContract
-
pulseTransactionCoordinator
public void pulseTransactionCoordinator()
Description copied from interface:LoadAccessContext
Callback to pulse the transaction coo- Specified by:
pulseTransactionCoordinator
in interfaceLoadAccessContext
- Overrides:
pulseTransactionCoordinator
in classAbstractSharedSessionContract
-
checkOpenOrWaitingForAutoClose
public void checkOpenOrWaitingForAutoClose()
Description copied from interface:LoadAccessContext
Callback to check whether the session is "active"- Specified by:
checkOpenOrWaitingForAutoClose
in interfaceLoadAccessContext
- Overrides:
checkOpenOrWaitingForAutoClose
in classAbstractSharedSessionContract
-
saveOrUpdate
@Deprecated public void saveOrUpdate(Object object) throws HibernateException
Deprecated.Description copied from interface:Session
EitherSession.save(Object)
orSession.update(Object)
the given instance, depending upon resolution of the unsaved-value checks (see the manual for discussion of unsaved-value checking). This operation cascades to associated instances if the association is mapped withCascadeType.SAVE_UPDATE
.- Specified by:
saveOrUpdate
in interfaceSession
- Parameters:
object
- a transient or detached instance containing new or updated state- Throws:
HibernateException
- See Also:
Session.save(Object)
,Session.update(Object object)
-
saveOrUpdate
@Deprecated public void saveOrUpdate(String entityName, Object obj) throws HibernateException
Deprecated.Description copied from interface:Session
EitherSession.save(String, Object)
orSession.update(String, Object)
the given instance, depending upon resolution of the unsaved-value checks (see the manual for discussion of unsaved-value checking). This operation cascades to associated instances if the association is mapped withCascadeType.SAVE_UPDATE
.- Specified by:
saveOrUpdate
in interfaceSession
- Parameters:
entityName
- the entity nameobj
- a transient or detached instance containing new or updated state- Throws:
HibernateException
- See Also:
Session.save(String,Object)
,Session.update(String,Object)
-
save
@Deprecated public Object save(Object obj) throws HibernateException
Deprecated.Description copied from interface:Session
Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if theassigned
generator is used.) This operation cascades to associated instances if the association is mapped withCascadeType.SAVE_UPDATE
.This operation is very similar to
Session.persist(Object)
.- Specified by:
save
in interfaceSession
- Parameters:
obj
- a transient instance of a persistent class- Returns:
- the generated identifier
- Throws:
HibernateException
-
save
@Deprecated public Object save(String entityName, Object object) throws HibernateException
Deprecated.Description copied from interface:Session
Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if theassigned
generator is used.) This operation cascades to associated instances if the association is mapped withCascadeType.SAVE_UPDATE
.- Specified by:
save
in interfaceSession
- Parameters:
entityName
- the entity nameobject
- a transient instance of a persistent class- Returns:
- the generated identifier
- Throws:
HibernateException
-
update
@Deprecated public void update(Object obj) throws HibernateException
Deprecated.Description copied from interface:Session
Update the persistent instance with the identifier of the given detached instance. If there is a persistent instance with the same identifier, an exception is thrown. This operation cascades to associated instances if the association is mapped withCascadeType.SAVE_UPDATE
.- Specified by:
update
in interfaceSession
- Parameters:
obj
- a detached instance containing updated state- Throws:
HibernateException
-
update
@Deprecated public void update(String entityName, Object object) throws HibernateException
Deprecated.Description copied from interface:Session
Update the persistent instance with the identifier of the given detached instance. If there is a persistent instance with the same identifier, an exception is thrown. This operation cascades to associated instances if the association is mapped withCascadeType.SAVE_UPDATE
.- Specified by:
update
in interfaceSession
- Parameters:
entityName
- the entity nameobject
- a detached instance containing updated state- Throws:
HibernateException
-
lock
public void lock(String entityName, Object object, LockMode lockMode) throws HibernateException
Description copied from interface:Session
Obtain the specified lock level on the given managed instance association with this session. This may be used to:- perform a version check with
LockMode.READ
, or - upgrade to a pessimistic lock with
LockMode.PESSIMISTIC_WRITE
).
CascadeType.LOCK
.Convenient form of
Session.LockRequest.lock(String, Object)
viaSession.buildLockRequest(LockOptions)
- Specified by:
lock
in interfaceSession
- Parameters:
entityName
- the name of the entityobject
- a persistent or transient instancelockMode
- the lock level- Throws:
HibernateException
- See Also:
Session.buildLockRequest(LockOptions)
,Session.LockRequest.lock(String, Object)
- perform a version check with
-
buildLockRequest
public Session.LockRequest buildLockRequest(LockOptions lockOptions)
Description copied from interface:Session
Build a newlock request
that specifies: Timeout and scope are ignored if the specifiedLockMode
represents a form of optimistic locking.Call
Session.LockRequest.lock(Object)
to actually obtain the requested lock on a managed entity instance.Example usage:
session.buildLockRequest().setLockMode(LockMode.PESSIMISTIC_WRITE).setTimeOut(60000).lock(entity);
- Specified by:
buildLockRequest
in interfaceSession
- Parameters:
lockOptions
- contains the lock level- Returns:
- a
Session.LockRequest
that can be used to lock any given object.
-
lock
public void lock(Object object, LockMode lockMode) throws HibernateException
Description copied from interface:Session
Obtain the specified lock level on the given managed instance association with this session. This may be used to:- perform a version check with
LockMode.READ
, or - upgrade to a pessimistic lock with
LockMode.PESSIMISTIC_WRITE
).
CascadeType.LOCK
.Convenient form of
Session.LockRequest.lock(Object)
viaSession.buildLockRequest(LockOptions)
- Specified by:
lock
in interfaceSession
- Parameters:
object
- a persistent or transient instancelockMode
- the lock level- Throws:
HibernateException
- See Also:
Session.buildLockRequest(LockOptions)
,Session.LockRequest.lock(Object)
- perform a version check with
-
persist
public void persist(String entityName, Object object) throws HibernateException
Description copied from interface:Session
Make a transient instance persistent and mark it for later insertion in the database. This operation cascades to associated instances if the association is mapped withCascadeType.PERSIST
.For entities with a
generated id
,persist()
ultimately results in generation of an identifier for the given instance. But this may happen asynchronously, when the session is flushed, depending on the identifier generation strategy.- Specified by:
persist
in interfaceSession
- Parameters:
entityName
- the entity nameobject
- a transient instance to be made persistent- Throws:
HibernateException
-
persist
public void persist(Object object) throws HibernateException
Description copied from interface:Session
Make a transient instance persistent and mark it for later insertion in the database. This operation cascades to associated instances if the association is mapped withCascadeType.PERSIST
.For entities with a
generated id
,persist()
ultimately results in generation of an identifier for the given instance. But this may happen asynchronously, when the session is flushed, depending on the identifier generation strategy.- Specified by:
persist
in interfacejakarta.persistence.EntityManager
- Specified by:
persist
in interfaceSession
- Parameters:
object
- a transient instance to be made persistent- Throws:
HibernateException
-
persist
public void persist(String entityName, Object object, PersistContext copiedAlready) throws HibernateException
Description copied from interface:EventSource
Cascade persist an entity instance- Specified by:
persist
in interfaceEventSource
- Specified by:
persist
in interfaceSessionImplementor
- Throws:
HibernateException
-
persistOnFlush
public void persistOnFlush(String entityName, Object object, PersistContext copiedAlready)
Description copied from interface:EventSource
Cascade persist an entity instance during the flush process- Specified by:
persistOnFlush
in interfaceEventSource
- Specified by:
persistOnFlush
in interfaceSessionImplementor
-
merge
public <T> T merge(String entityName, T object) throws HibernateException
Description copied from interface:Session
Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved, save a copy and return it as a newly persistent instance. The given instance does not become associated with the session. This operation cascades to associated instances if the association is mapped withCascadeType.MERGE
.- Specified by:
merge
in interfaceSession
- Parameters:
entityName
- the entity nameobject
- a detached instance with state to be copied- Returns:
- an updated persistent instance
- Throws:
HibernateException
-
merge
public <T> T merge(T object) throws HibernateException
Description copied from interface:Session
Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved, save a copy and return it as a newly persistent instance. The given instance does not become associated with the session. This operation cascades to associated instances if the association is mapped withCascadeType.MERGE
.- Specified by:
merge
in interfacejakarta.persistence.EntityManager
- Specified by:
merge
in interfaceSession
- Parameters:
object
- a detached instance with state to be copied- Returns:
- an updated persistent instance
- Throws:
HibernateException
-
merge
public void merge(String entityName, Object object, MergeContext copiedAlready) throws HibernateException
Description copied from interface:EventSource
Cascade merge an entity instance- Specified by:
merge
in interfaceEventSource
- Specified by:
merge
in interfaceSessionImplementor
- Throws:
HibernateException
-
delete
@Deprecated public void delete(Object object) throws HibernateException
Deprecated.Description copied from interface:Session
Remove a persistent instance from the datastore. The argument may be an instance associated with the receivingSession
or a transient instance with an identifier associated with existing persistent state. This operation cascades to associated instances if the association is mapped withCascadeType.REMOVE
.- Specified by:
delete
in interfaceSession
- Parameters:
object
- the instance to be removed- Throws:
HibernateException
-
delete
@Deprecated public void delete(String entityName, Object object) throws HibernateException
Deprecated.Description copied from interface:Session
Remove a persistent instance from the datastore. The second argument may be an instance associated with the receivingSession
or a transient instance with an identifier associated with existing persistent state. This operation cascades to associated instances if the association is mapped withCascadeType.REMOVE
.- Specified by:
delete
in interfaceSession
- Parameters:
entityName
- the entity name for the instance to be removed.object
- the instance to be removed- Throws:
HibernateException
-
delete
public void delete(String entityName, Object object, boolean isCascadeDeleteEnabled, DeleteContext transientEntities) throws HibernateException
Description copied from interface:EventSource
Cascade delete an entity instance- Specified by:
delete
in interfaceEventSource
- Specified by:
delete
in interfaceSessionImplementor
- Throws:
HibernateException
-
removeOrphanBeforeUpdates
public void removeOrphanBeforeUpdates(String entityName, Object child)
Description copied from interface:EventSource
A specialized type of deletion for orphan removal that must occur prior to queued inserts and updates.- Specified by:
removeOrphanBeforeUpdates
in interfaceEventSource
- Specified by:
removeOrphanBeforeUpdates
in interfaceSessionImplementor
-
load
public void load(Object object, Object id) throws HibernateException
Description copied from interface:Session
Read the persistent state associated with the given identifier into the given transient instance.- Specified by:
load
in interfaceSession
- Throws:
HibernateException
-
load
@Deprecated public <T> T load(Class<T> entityClass, Object id) throws HibernateException
Deprecated.Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, making the assumption that the instance exists in the database. This method might return a proxied instance that is initialized on-demand, when a non-identifier method is accessed.You should not use this method to determine if an instance exists in the database (use
get()
instead). Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.This operation is very similar to
Session.getReference(Class, Object)
.- Specified by:
load
in interfaceSession
- Parameters:
entityClass
- a persistent classid
- a valid identifier of an existing persistent instance of the class- Returns:
- the persistent instance or proxy
- Throws:
HibernateException
-
load
@Deprecated public Object load(String entityName, Object id) throws HibernateException
Deprecated.Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, making the assumption that the instance exists in the database. This method might return a proxied instance that is initialized on-demand, when a non-identifier method is accessed.You should not use this method to determine if an instance exists in the database (use
get()
instead). Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.- Specified by:
load
in interfaceSession
- Specified by:
load
in classAbstractSharedSessionContract
- Parameters:
entityName
- a persistent classid
- a valid identifier of an existing persistent instance of the class- Returns:
- the persistent instance or proxy
- Throws:
HibernateException
-
get
public <T> T get(Class<T> entityClass, Object id) throws HibernateException
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.This operation is very similar to
EntityManager.find(Class, Object)
.- Specified by:
get
in interfaceSession
- Parameters:
entityClass
- the entity typeid
- an identifier- Returns:
- a persistent instance or null
- Throws:
HibernateException
-
get
public Object get(String entityName, Object id) throws HibernateException
Description copied from interface:Session
Return the persistent instance of the given named entity with the given identifier, or null if there is no such persistent instance. If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.- Specified by:
get
in interfaceSession
- Parameters:
entityName
- the entity nameid
- an identifier- Returns:
- a persistent instance or null
- Throws:
HibernateException
-
immediateLoad
public Object immediateLoad(String entityName, Object id) throws HibernateException
Load the data for the object with the specified id into a newly created object. This is only called when lazily initializing a proxy. Do NOT return a proxy.- Specified by:
immediateLoad
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
internalLoad
public Object internalLoad(String entityName, Object id, boolean eager, boolean nullable)
Description copied from interface:SharedSessionContractImplementor
Load an instance without checking if it was deleted. Whennullable
is disabled this method may create a new proxy or return an existing proxy; if it does not exist, throw an exception. Whennullable
is enabled, the method does not create new proxies (but might return an existing proxy); if it does not exist, returnnull
. Wheneager
is enabled, the object is eagerly fetched- Specified by:
internalLoad
in interfaceSharedSessionContractImplementor
-
load
@Deprecated public <T> T load(Class<T> entityClass, Object id, LockMode lockMode) throws HibernateException
Deprecated.Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists. Convenient form ofSession.load(Class, Object, LockOptions)
.- Specified by:
load
in interfaceSession
- Parameters:
entityClass
- a persistent classid
- a valid identifier of an existing persistent instance of the classlockMode
- the lock level- Returns:
- the persistent instance or proxy
- Throws:
HibernateException
- See Also:
Session.load(Class, Object, LockOptions)
-
load
@Deprecated public <T> T load(Class<T> entityClass, Object id, LockOptions lockOptions) throws HibernateException
Deprecated.Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.- Specified by:
load
in interfaceSession
- Parameters:
entityClass
- a persistent classid
- a valid identifier of an existing persistent instance of the classlockOptions
- contains the lock level- Returns:
- the persistent instance or proxy
- Throws:
HibernateException
-
load
@Deprecated public Object load(String entityName, Object id, LockMode lockMode) throws HibernateException
Deprecated.Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists. Convenient form ofSession.load(String, Object, LockOptions)
.- Specified by:
load
in interfaceSession
- Parameters:
entityName
- a persistent classid
- a valid identifier of an existing persistent instance of the classlockMode
- the lock level- Returns:
- the persistent instance or proxy
- Throws:
HibernateException
- See Also:
Session.load(String, Object, LockOptions)
-
load
@Deprecated public Object load(String entityName, Object id, LockOptions lockOptions) throws HibernateException
Deprecated.Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.- Specified by:
load
in interfaceSession
- Parameters:
entityName
- a persistent classid
- a valid identifier of an existing persistent instance of the classlockOptions
- contains the lock level- Returns:
- the persistent instance or proxy
- Throws:
HibernateException
-
get
public <T> T get(Class<T> entityClass, Object id, LockMode lockMode) throws HibernateException
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance. Obtain the specified lock mode if the instance exists.Convenient form of
Session.get(Class, Object, LockOptions)
.This operation is very similar to
EntityManager.find(Class, Object, jakarta.persistence.LockModeType)
.- Specified by:
get
in interfaceSession
- Parameters:
entityClass
- the entity typeid
- an identifierlockMode
- the lock mode- Returns:
- a persistent instance or null
- Throws:
HibernateException
- See Also:
Session.get(Class, Object, LockOptions)
-
get
public <T> T get(Class<T> entityClass, Object id, LockOptions lockOptions) throws HibernateException
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance. Obtain the specified lock mode if the instance exists.- Specified by:
get
in interfaceSession
- Parameters:
entityClass
- the entity typeid
- an identifierlockOptions
- the lock mode- Returns:
- a persistent instance or null
- Throws:
HibernateException
-
get
public Object get(String entityName, Object id, LockMode lockMode) throws HibernateException
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.) Obtain the specified lock mode if the instance exists. Convenient form ofSession.get(String, Object, LockOptions)
- Specified by:
get
in interfaceSession
- Parameters:
entityName
- the entity nameid
- an identifierlockMode
- the lock mode- Returns:
- a persistent instance or null
- Throws:
HibernateException
- See Also:
Session.get(String, Object, LockOptions)
-
get
public Object get(String entityName, Object id, LockOptions lockOptions) throws HibernateException
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance. Obtain the specified lock mode if the instance exists.- Specified by:
get
in interfaceSession
- Parameters:
entityName
- the entity nameid
- an identifierlockOptions
- contains the lock mode- Returns:
- a persistent instance or null
- Throws:
HibernateException
-
byId
public <T> IdentifierLoadAccessImpl<T> byId(String entityName)
Description copied from interface:Session
Create anIdentifierLoadAccess
instance to retrieve the specified entity type by primary key.
-
byId
public <T> IdentifierLoadAccessImpl<T> byId(Class<T> entityClass)
Description copied from interface:Session
Create anIdentifierLoadAccess
instance to retrieve the specified entity by primary key.
-
byMultipleIds
public <T> MultiIdentifierLoadAccess<T> byMultipleIds(Class<T> entityClass)
Description copied from interface:Session
Create aMultiIdentifierLoadAccess
instance to retrieve multiple entities at once as specified by primary key values.- Specified by:
byMultipleIds
in interfaceSession
- Parameters:
entityClass
- the entity type to be retrieved- Returns:
- load delegate for loading the specified entity type by primary key values
-
byMultipleIds
public <T> MultiIdentifierLoadAccess<T> byMultipleIds(String entityName)
Description copied from interface:Session
Create aMultiIdentifierLoadAccess
instance to retrieve multiple entities at once as specified by primary key values.- Specified by:
byMultipleIds
in interfaceSession
- Parameters:
entityName
- the entity name of the entity type to be retrieved- Returns:
- load delegate for loading the specified entity type by primary key values
-
byNaturalId
public <T> NaturalIdLoadAccess<T> byNaturalId(String entityName)
Description copied from interface:Session
Create aNaturalIdLoadAccess
instance to retrieve the specified entity by its natural id.- Specified by:
byNaturalId
in interfaceSession
- Parameters:
entityName
- the entity name of the entity type to be retrieved- Returns:
- load delegate for loading the specified entity type by natural id
-
byNaturalId
public <T> NaturalIdLoadAccess<T> byNaturalId(Class<T> entityClass)
Description copied from interface:Session
Create aNaturalIdLoadAccess
instance to retrieve the specified entity by its natural id.- Specified by:
byNaturalId
in interfaceSession
- Parameters:
entityClass
- the entity type to be retrieved- Returns:
- load delegate for loading the specified entity type by natural id
-
bySimpleNaturalId
public <T> SimpleNaturalIdLoadAccess<T> bySimpleNaturalId(String entityName)
Description copied from interface:Session
Create aSimpleNaturalIdLoadAccess
instance to retrieve the specified entity by itsnatural id
.- Specified by:
bySimpleNaturalId
in interfaceSession
- Parameters:
entityName
- the entity name of the entity type to be retrieved- Returns:
- load delegate for loading the specified entity type by natural id
-
bySimpleNaturalId
public <T> SimpleNaturalIdLoadAccess<T> bySimpleNaturalId(Class<T> entityClass)
Description copied from interface:Session
Create aSimpleNaturalIdLoadAccess
instance to retrieve the specified entity by its simple (single attribute)natural id
.- Specified by:
bySimpleNaturalId
in interfaceSession
- Parameters:
entityClass
- the entity type to be retrieved- Returns:
- load delegate for loading the specified entity type by natural id
-
byMultipleNaturalId
public <T> NaturalIdMultiLoadAccess<T> byMultipleNaturalId(Class<T> entityClass)
Description copied from interface:Session
Access to load multiple entities bynatural id
.- Specified by:
byMultipleNaturalId
in interfaceSession
-
byMultipleNaturalId
public <T> NaturalIdMultiLoadAccess<T> byMultipleNaturalId(String entityName)
Description copied from interface:Session
Access to load multiple entities bynatural id
.- Specified by:
byMultipleNaturalId
in interfaceSession
-
fireLoad
public void fireLoad(LoadEvent event, LoadEventListener.LoadType loadType)
- Specified by:
fireLoad
in interfaceLoadAccessContext
-
refresh
public void refresh(Object object) throws HibernateException
Description copied from interface:Session
Reread the state of the given managed instance associated with this session from the underlying database. This may be useful:- when a database trigger alters the object state upon insert or update
- after executing any HQL update or delete statement
- after executing a native SQL statement
- after inserting a
Blob
orClob
CascadeType.REFRESH
.- Specified by:
refresh
in interfacejakarta.persistence.EntityManager
- Specified by:
refresh
in interfaceSession
- Parameters:
object
- a persistent or detached instance- Throws:
HibernateException
-
refresh
@Deprecated public void refresh(String entityName, Object object) throws HibernateException
Deprecated.Description copied from interface:Session
Reread the state of the given managed instance associated with this session from the underlying database. This may be useful:- when a database trigger alters the object state upon insert or update
- after executing any HQL update or delete statement
- after executing a native SQL statement
- after inserting a
Blob
orClob
CascadeType.REFRESH
.- Specified by:
refresh
in interfaceSession
- Parameters:
entityName
- a persistent classobject
- a persistent or detached instance- Throws:
HibernateException
-
refresh
public void refresh(Object object, LockMode lockMode) throws HibernateException
Description copied from interface:Session
Reread the state of the given managed instance from the underlying database, obtaining the givenLockMode
.Convenient form of
Session.refresh(Object, LockOptions)
- Specified by:
refresh
in interfaceSession
- Parameters:
object
- a persistent or detached instancelockMode
- the lock mode to use- Throws:
HibernateException
- See Also:
Session.refresh(Object, LockOptions)
-
refresh
public void refresh(Object object, LockOptions lockOptions) throws HibernateException
Description copied from interface:Session
Reread the state of the given managed instance from the underlying database, obtaining the givenLockMode
.- Specified by:
refresh
in interfaceSession
- Parameters:
object
- a persistent or detached instancelockOptions
- contains the lock mode to use- Throws:
HibernateException
-
refresh
@Deprecated public void refresh(String entityName, Object object, LockOptions lockOptions) throws HibernateException
Deprecated.Description copied from interface:Session
Reread the state of the given managed instance from the underlying database, obtaining the givenLockMode
.- Specified by:
refresh
in interfaceSession
- Parameters:
entityName
- a persistent classobject
- a persistent or detached instancelockOptions
- contains the lock mode to use- Throws:
HibernateException
-
refresh
public void refresh(String entityName, Object object, RefreshContext refreshedAlready) throws HibernateException
Description copied from interface:EventSource
Cascade refresh an entity instance- Specified by:
refresh
in interfaceEventSource
- Specified by:
refresh
in interfaceSessionImplementor
- Throws:
HibernateException
-
replicate
public void replicate(Object obj, ReplicationMode replicationMode) throws HibernateException
Description copied from interface:Session
Persist the state of the given detached instance, reusing the current identifier value. This operation cascades to associated instances if the association is mapped withCascadeType.REPLICATE
.- Specified by:
replicate
in interfaceSession
- Parameters:
obj
- a detached instance of a persistent classreplicationMode
- the replication mode to use- Throws:
HibernateException
-
replicate
public void replicate(String entityName, Object obj, ReplicationMode replicationMode) throws HibernateException
Description copied from interface:Session
Persist the state of the given detached instance, reusing the current identifier value. This operation cascades to associated instances if the association is mapped withCascadeType.REPLICATE
.- Specified by:
replicate
in interfaceSession
- Parameters:
entityName
- the entity nameobj
- a detached instance of a persistent classreplicationMode
- the replication mode to use- Throws:
HibernateException
-
evict
public void evict(Object object) throws HibernateException
remove any hard references to the entity that are held by the infrastructure (references held by application or other persistent instances are okay)- Specified by:
evict
in interfaceSession
- Parameters:
object
- the managed entity to evict- Throws:
HibernateException
-
autoFlushIfRequired
public boolean autoFlushIfRequired(Set<String> querySpaces) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
detect in-memory changes, determine if the changes are to tables named in the query and, if so, complete execution the flush- Specified by:
autoFlushIfRequired
in interfaceSharedSessionContractImplementor
- Parameters:
querySpaces
- the tables named in the query.- Returns:
- true if flush is required, false otherwise.
- Throws:
HibernateException
-
isDirty
public boolean isDirty() throws HibernateException
Description copied from interface:Session
Does this session contain any changes which must be synchronized with the database? In other words, would any DML operations be executed if we flushed this session?- Specified by:
isDirty
in interfaceSession
- Returns:
true
if the session contains pending changes;false
otherwise.- Throws:
HibernateException
- could not perform dirtying checking
-
flush
public void flush() throws HibernateException
Description copied from interface:Session
Force this session to flush. Must be called at the end of a unit of work, before the transaction is committed. Depending on the currentSession.setHibernateFlushMode(FlushMode)
flush mode}, the session might automatically flush whenEntityTransaction.commit()
is called, and it is not necessary to call this method directly.Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory.
- Specified by:
flush
in interfacejakarta.persistence.EntityManager
- Specified by:
flush
in interfaceSession
- Specified by:
flush
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
- if changes could not be synchronized with the database
-
setFlushMode
public void setFlushMode(jakarta.persistence.FlushModeType flushModeType)
Description copied from interface:Session
Set the currentJPA flush mode
for this session.Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory. The current flush mode determines when the session is automatically flushed.
- Specified by:
setFlushMode
in interfacejakarta.persistence.EntityManager
- Specified by:
setFlushMode
in interfaceSession
- Parameters:
flushModeType
- the newFlushModeType
- See Also:
for additional options
-
forceFlush
public void forceFlush(EntityEntry entityEntry) throws HibernateException
Description copied from interface:EventSource
Force an immediate flush- Specified by:
forceFlush
in interfaceEventSource
- Specified by:
forceFlush
in interfaceSessionImplementor
- Throws:
HibernateException
-
instantiate
public Object instantiate(String entityName, Object id) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Instantiate the entity class, initializing with the given identifier- Specified by:
instantiate
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
instantiate
public Object instantiate(EntityPersister persister, Object id) throws HibernateException
give the interceptor an opportunity to override the default instantiation- Specified by:
instantiate
in interfaceEventSource
- Specified by:
instantiate
in interfaceSessionImplementor
- Specified by:
instantiate
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
getEntityPersister
public EntityPersister getEntityPersister(String entityName, Object object)
Description copied from interface:SharedSessionContractImplementor
Get theEntityPersister
for any instance- Specified by:
getEntityPersister
in interfaceSharedSessionContractImplementor
- Parameters:
entityName
- optional entity nameobject
- the entity instance
-
getIdentifier
public Object getIdentifier(Object object) throws HibernateException
Description copied from interface:Session
Return the identifier value of the given entity associated with this session. An exception is thrown if the given entity instance is transient or detached in relation to this session.- Specified by:
getIdentifier
in interfaceSession
- Parameters:
object
- a persistent instance associated with this session- Returns:
- the identifier
- Throws:
TransientObjectException
- if the instance is transient or associated with a different sessionHibernateException
-
getContextEntityIdentifier
public Object getContextEntityIdentifier(Object object)
Get the id value for an object that is actually associated with the session. This is a bit stricter than getEntityIdentifierIfNotUnsaved().- Specified by:
getContextEntityIdentifier
in interfaceSharedSessionContractImplementor
-
contains
public boolean contains(Object object)
- Specified by:
contains
in interfacejakarta.persistence.EntityManager
-
contains
public boolean contains(String entityName, Object object)
Description copied from interface:Session
Determine if the given entity is associated with this session.
-
createStoredProcedureCall
public ProcedureCall createStoredProcedureCall(String procedureName)
Description copied from interface:SharedSessionContract
Create aProcedureCall
to a stored procedure.- Specified by:
createStoredProcedureCall
in interfaceSharedSessionContract
- Overrides:
createStoredProcedureCall
in classAbstractSharedSessionContract
- Parameters:
procedureName
- The name of the procedure.- Returns:
- The representation of the procedure call.
-
createStoredProcedureCall
public ProcedureCall createStoredProcedureCall(String procedureName, String... resultSetMappings)
Description copied from interface:SharedSessionContract
Create aProcedureCall
to a stored procedure with the given result set entity mappings.- Specified by:
createStoredProcedureCall
in interfaceSharedSessionContract
- Overrides:
createStoredProcedureCall
in classAbstractSharedSessionContract
- Parameters:
procedureName
- The name of the procedure.resultSetMappings
- The explicit result set mapping(s) to use for mapping the results- Returns:
- The representation of the procedure call.
-
createStoredProcedureCall
public ProcedureCall createStoredProcedureCall(String procedureName, Class<?>... resultClasses)
Description copied from interface:SharedSessionContract
Create aProcedureCall
to a stored procedure with the given result set entity mappings. Each given class is considered a "root return".- Specified by:
createStoredProcedureCall
in interfaceSharedSessionContract
- Overrides:
createStoredProcedureCall
in classAbstractSharedSessionContract
- Parameters:
procedureName
- The name of the procedure.resultClasses
- The entity(s) to map the result on to.- Returns:
- The representation of the procedure call.
-
getSessionFactory
public SessionFactoryImplementor getSessionFactory()
Description copied from interface:WrapperOptions
Access to the current Session- Specified by:
getSessionFactory
in interfaceSession
- Specified by:
getSessionFactory
in interfaceSessionImplementor
- Specified by:
getSessionFactory
in interfaceSharedSessionContractImplementor
- Specified by:
getSessionFactory
in interfaceWrapperOptions
- Returns:
- the session factory
- See Also:
SessionFactory
-
initializeCollection
public void initializeCollection(PersistentCollection<?> collection, boolean writing)
Description copied from interface:SharedSessionContractImplementor
Initialize the collection (if not already initialized)- Specified by:
initializeCollection
in interfaceSharedSessionContractImplementor
-
bestGuessEntityName
public String bestGuessEntityName(Object object)
Description copied from interface:SharedSessionContractImplementor
The best guess entity name for an entity not in an association- Specified by:
bestGuessEntityName
in interfaceSharedSessionContractImplementor
-
getEntityName
public String getEntityName(Object object)
Description copied from interface:Session
Return the entity name for a persistent entity.- Specified by:
getEntityName
in interfaceSession
- Parameters:
object
- a persistent entity associated with this session- Returns:
- the entity name
-
getReference
public <T> T getReference(T object)
Description copied from interface:Session
Return a reference to the persistent instance with the same identity as the given instance, which might be detached, making the assumption that the instance is still persistent in the database. This method never results in access to the underlying data store, and thus might return a proxy that is initialized on-demand, when a non-identifier method is accessed.- Specified by:
getReference
in interfaceSession
- Parameters:
object
- a detached persistent instance- Returns:
- the persistent instance or proxy
-
guessEntityName
public String guessEntityName(Object object) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
The guessed entity name for an entity not in an association- Specified by:
guessEntityName
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
cancelQuery
public void cancelQuery() throws HibernateException
Description copied from interface:Session
Cancel the execution of the current query. This is the sole method on session which may be safely called from another thread.- Specified by:
cancelQuery
in interfaceSession
- Throws:
HibernateException
- if there was a problem cancelling the query
-
getActionQueue
public ActionQueue getActionQueue()
Description copied from interface:EventSource
Get the ActionQueue for this session- Specified by:
getActionQueue
in interfaceEventSource
- Specified by:
getActionQueue
in interfaceSessionImplementor
-
getPersistenceContext
public PersistenceContext getPersistenceContext()
Description copied from interface:SharedSessionContractImplementor
Get the persistence context for this session. See alsoSharedSessionContractImplementor.getPersistenceContextInternal()
for an alternative. This method is not extremely fast: if you need to access the PersistenceContext multiple times, prefer keeping a reference to it over invoking this method multiple times.- Specified by:
getPersistenceContext
in interfaceSharedSessionContractImplementor
-
getPersistenceContextInternal
public PersistenceContext getPersistenceContextInternal()
Description copied from interface:SharedSessionContractImplementor
This is similar toSharedSessionContractImplementor.getPersistenceContext()
, with two main differences: a) this version performs better as it allows for inlining and probably better prediction b) see SessionImplSharedSessionContractImplementor.getPersistenceContext()
: it does some checks on the current state of the Session. Choose wisely: performance is important, correctness comes first.- Specified by:
getPersistenceContextInternal
in interfaceSharedSessionContractImplementor
- Returns:
- the PersistenceContext associated to this session.
-
getStatistics
public SessionStatistics getStatistics()
Description copied from interface:Session
Get the statistics for this session.- Specified by:
getStatistics
in interfaceSession
- Returns:
- the session statistics being collected for this session
-
isEventSource
public boolean isEventSource()
- Specified by:
isEventSource
in interfaceSharedSessionContractImplementor
-
isDefaultReadOnly
public boolean isDefaultReadOnly()
Description copied from interface:Session
Will entities and proxies that are loaded into this session be made read-only by default?To determine the read-only/modifiable setting for a particular entity or proxy use
Session.isReadOnly(Object)
.- Specified by:
isDefaultReadOnly
in interfaceSession
- Specified by:
isDefaultReadOnly
in interfaceSharedSessionContractImplementor
- Returns:
true
, loaded entities/proxies will be made read-only by default;false
, loaded entities/proxies will be made modifiable by default.- See Also:
Session.isReadOnly(Object)
-
setDefaultReadOnly
public void setDefaultReadOnly(boolean defaultReadOnly)
Description copied from interface:Session
Change the default for entities and proxies loaded into this session from modifiable to read-only mode, or from modifiable to read-only mode.Read-only entities are not dirty-checked and snapshots of persistent state are not maintained. Read-only entities can be modified, but changes are not persisted.
When a proxy is initialized, the loaded entity will have the same read-only/modifiable setting as the uninitialized proxy has, regardless of the session's current setting.
To change the read-only/modifiable setting for a particular entity or proxy that already belongs to this session use
Session.setReadOnly(Object, boolean)
.To override this session's read-only/modifiable setting for all entities and proxies loaded by a certain
Query
useQuery.setReadOnly(boolean)
.- Specified by:
setDefaultReadOnly
in interfaceSession
- Parameters:
defaultReadOnly
-true
, the default for loaded entities/proxies is read-only;false
, the default for loaded entities/proxies is modifiable- See Also:
Session.setReadOnly(Object,boolean)
,Query.setReadOnly(boolean)
-
isReadOnly
public boolean isReadOnly(Object entityOrProxy)
Description copied from interface:Session
Is the specified entity or proxy read-only?To get the default read-only/modifiable setting used for entities and proxies that are loaded into the session use
Session.isDefaultReadOnly()
- Specified by:
isReadOnly
in interfaceSession
- Parameters:
entityOrProxy
- an entity or proxy- Returns:
true
if the entity or proxy is read-only,false
if the entity or proxy is modifiable.- See Also:
Session.isDefaultReadOnly()
-
setReadOnly
public void setReadOnly(Object entity, boolean readOnly)
Description copied from interface:Session
Set an unmodified persistent object to read-only mode, or a read-only object to modifiable mode. In read-only mode, no snapshot is maintained, the instance is never dirty checked, and changes are not persisted.If the entity or proxy already has the specified read-only/modifiable setting, then this method does nothing.
To set the default read-only/modifiable setting used for all entities and proxies that are loaded into the session use
Session.setDefaultReadOnly(boolean)
.To override this session's read-only/modifiable setting for entities and proxies loaded by a
Query
useQuery.setReadOnly(boolean)
- Specified by:
setReadOnly
in interfaceSession
- Parameters:
entity
- an entity or proxyreadOnly
-true
if the entity or proxy should be made read-only;false
if the entity or proxy should be made modifiable- See Also:
Session.setDefaultReadOnly(boolean)
,Query.setReadOnly(boolean)
-
afterScrollOperation
public void afterScrollOperation()
- Specified by:
afterScrollOperation
in interfaceSharedSessionContractImplementor
-
getLoadQueryInfluencers
public LoadQueryInfluencers getLoadQueryInfluencers()
Description copied from interface:SharedSessionContractImplementor
Get the load query influencers associated with this session.- Specified by:
getLoadQueryInfluencers
in interfaceSharedSessionContractImplementor
- Returns:
- the load query influencers associated with this session; should never be null.
-
getEnabledFilter
public Filter getEnabledFilter(String filterName)
Description copied from interface:Session
Retrieve a currently enabled filter by name.- Specified by:
getEnabledFilter
in interfaceSession
- Parameters:
filterName
- the name of the filter to be retrieved.- Returns:
- the
Filter
instance representing the enabled filter.
-
enableFilter
public Filter enableFilter(String filterName)
Description copied from interface:Session
Enable the named filter for this current session.- Specified by:
enableFilter
in interfaceSession
- Parameters:
filterName
- the name of the filter to be enabled.- Returns:
- the
Filter
instance representing the enabled filter.
-
disableFilter
public void disableFilter(String filterName)
Description copied from interface:Session
Disable the named filter for the current session.- Specified by:
disableFilter
in interfaceSession
- Parameters:
filterName
- the name of the filter to be disabled.
-
isFetchProfileEnabled
public boolean isFetchProfileEnabled(String name) throws UnknownProfileException
Description copied from interface:Session
Is a particular fetch profile enabled on this session?- Specified by:
isFetchProfileEnabled
in interfaceSession
- Parameters:
name
- the name of the profile to be checked.- Returns:
- True if fetch profile is enabled; false if not.
- Throws:
UnknownProfileException
- Indicates that the given name does not match any known profile names- See Also:
for discussion of this feature
-
enableFetchProfile
public void enableFetchProfile(String name) throws UnknownProfileException
Description copied from interface:Session
Enable a particular fetch profile on this session. If the requested profile is already enabled, the call has no effect.- Specified by:
enableFetchProfile
in interfaceSession
- Parameters:
name
- the name of the fetch profile to be enabled- Throws:
UnknownProfileException
- Indicates that the given name does not match any known profile names- See Also:
for discussion of this feature
-
disableFetchProfile
public void disableFetchProfile(String name) throws UnknownProfileException
Description copied from interface:Session
Disable a particular fetch profile on this session. If the requested profile is already enabled, the call has no effect.- Specified by:
disableFetchProfile
in interfaceSession
- Parameters:
name
- the name of the fetch profile to be disabled- Throws:
UnknownProfileException
- Indicates that the given name does not match any known profile names- See Also:
for discussion of this feature
-
getLobHelper
public LobHelper getLobHelper()
Description copied from interface:Session
Retrieve this session's helper/delegate for creating LOB instances.- Specified by:
getLobHelper
in interfaceSession
- Returns:
- this session's
LOB helper
-
beforeTransactionCompletion
public void beforeTransactionCompletion()
Description copied from interface:JdbcSessionOwner
A before-completion callback to the owner.- Specified by:
beforeTransactionCompletion
in interfaceJdbcSessionOwner
- Overrides:
beforeTransactionCompletion
in classAbstractSharedSessionContract
-
afterTransactionCompletion
public void afterTransactionCompletion(boolean successful, boolean delayed)
Description copied from interface:JdbcSessionOwner
An after-completion callback to the owner.- Specified by:
afterTransactionCompletion
in interfaceJdbcSessionOwner
- Overrides:
afterTransactionCompletion
in classAbstractSharedSessionContract
- Parameters:
successful
- Was the transaction successful?delayed
- Is this a delayed after transaction completion call (aka after a timeout)?
-
addSharedSessionTransactionObserver
protected void addSharedSessionTransactionObserver(TransactionCoordinator transactionCoordinator)
- Overrides:
addSharedSessionTransactionObserver
in classAbstractSharedSessionContract
-
removeSharedSessionTransactionObserver
protected void removeSharedSessionTransactionObserver(TransactionCoordinator transactionCoordinator)
- Overrides:
removeSharedSessionTransactionObserver
in classAbstractSharedSessionContract
-
startTransactionBoundary
public void startTransactionBoundary()
Description copied from interface:JdbcSessionOwner
Callback indicating recognition of entering into a transactional context whether that is explicitly via the HibernateTransaction
API or via registration of Hibernate's JTA Synchronization impl with a JTA Transaction- Specified by:
startTransactionBoundary
in interfaceJdbcSessionOwner
- Overrides:
startTransactionBoundary
in classAbstractSharedSessionContract
-
afterTransactionBegin
public void afterTransactionBegin()
Description copied from interface:JdbcSessionOwner
A after-begin callback from the coordinator to its owner.- Specified by:
afterTransactionBegin
in interfaceJdbcSessionOwner
-
flushBeforeTransactionCompletion
public void flushBeforeTransactionCompletion()
- Specified by:
flushBeforeTransactionCompletion
in interfaceJdbcSessionOwner
-
getSession
public SessionImplementor getSession()
Description copied from interface:WrapperOptions
Access to the current Session- Specified by:
getSession
in interfaceLoadAccessContext
- Specified by:
getSession
in interfaceSessionImplementor
- Specified by:
getSession
in interfaceSharedSessionContractImplementor
- Specified by:
getSession
in interfaceWrapperOptions
-
remove
public void remove(Object entity)
Description copied from interface:Session
Mark a persistence instance associated with this session for removal from the underlying database. Ths operation cascades to associated instances if the association is mappedCascadeType.REMOVE
.
-
find
public <T> T find(Class<T> entityClass, Object primaryKey)
- Specified by:
find
in interfacejakarta.persistence.EntityManager
-
find
public <T> T find(Class<T> entityClass, Object primaryKey, Map<String,Object> properties)
- Specified by:
find
in interfacejakarta.persistence.EntityManager
-
find
public <T> T find(Class<T> entityClass, Object primaryKey, jakarta.persistence.LockModeType lockModeType)
- Specified by:
find
in interfacejakarta.persistence.EntityManager
-
find
public <T> T find(Class<T> entityClass, Object primaryKey, jakarta.persistence.LockModeType lockModeType, Map<String,Object> properties)
- Specified by:
find
in interfacejakarta.persistence.EntityManager
-
determineAppropriateLocalCacheMode
protected CacheMode determineAppropriateLocalCacheMode(Map<String,Object> localProperties)
-
getReference
public <T> T getReference(Class<T> entityClass, Object id)
Description copied from interface:Session
Return a reference to the persistent instance with the given class and identifier, making the assumption that the instance is still persistent in the database. This method never results in access to the underlying data store, and thus might return a proxy that is initialized on-demand, when a non-identifier method is accessed.Note that
Hibernate.createDetachedProxy(SessionFactory, Class, Object)
may be used to obtain a detached reference.- Specified by:
getReference
in interfacejakarta.persistence.EntityManager
- Specified by:
getReference
in interfaceSession
- Parameters:
entityClass
- the entity typeid
- the identifier of a persistent instance that exists in the database- Returns:
- the persistent instance or proxy
-
getReference
public Object getReference(String entityName, Object id)
Description copied from interface:Session
Return a reference to the persistent instance of the given named entity with the given identifier, making the assumption that the instance is still persistent in the database. This method never results in access to the underlying data store, and thus might return a proxy that is initialized on-demand, when a non-identifier method is accessed.- Specified by:
getReference
in interfaceSession
- Parameters:
entityName
- the entity nameid
- the identifier of a persistent instance that exists in the database- Returns:
- the persistent instance or proxy
-
lock
public void lock(Object entity, jakarta.persistence.LockModeType lockModeType)
- Specified by:
lock
in interfacejakarta.persistence.EntityManager
-
lock
public void lock(Object entity, jakarta.persistence.LockModeType lockModeType, Map<String,Object> properties)
- Specified by:
lock
in interfacejakarta.persistence.EntityManager
-
refresh
public void refresh(Object entity, Map<String,Object> properties)
- Specified by:
refresh
in interfacejakarta.persistence.EntityManager
-
refresh
public void refresh(Object entity, jakarta.persistence.LockModeType lockModeType)
- Specified by:
refresh
in interfacejakarta.persistence.EntityManager
-
refresh
public void refresh(Object entity, jakarta.persistence.LockModeType lockModeType, Map<String,Object> properties)
- Specified by:
refresh
in interfacejakarta.persistence.EntityManager
-
detach
public void detach(Object entity)
Description copied from interface:Session
Remove this instance from the session cache. Changes to the instance will not be synchronized with the database. This operation cascades to associated instances if the association is mapped withCascadeType.DETACH
.
-
getLockMode
public jakarta.persistence.LockModeType getLockMode(Object entity)
- Specified by:
getLockMode
in interfacejakarta.persistence.EntityManager
-
setProperty
public void setProperty(String propertyName, Object value)
- Specified by:
setProperty
in interfacejakarta.persistence.EntityManager
-
getProperties
public Map<String,Object> getProperties()
- Specified by:
getProperties
in interfacejakarta.persistence.EntityManager
-
createNamedStoredProcedureQuery
public ProcedureCall createNamedStoredProcedureQuery(String name)
Description copied from interface:SharedSessionContract
Obtain aProcedureCall
based on a named template- Specified by:
createNamedStoredProcedureQuery
in interfacejakarta.persistence.EntityManager
- Specified by:
createNamedStoredProcedureQuery
in interfaceSharedSessionContract
- Overrides:
createNamedStoredProcedureQuery
in classAbstractSharedSessionContract
- Parameters:
name
- The name given to the template- Returns:
- The ProcedureCall
- See Also:
NamedStoredProcedureQuery
-
createStoredProcedureQuery
public ProcedureCall createStoredProcedureQuery(String procedureName)
Description copied from interface:SharedSessionContract
Create aProcedureCall
to a stored procedure.- Specified by:
createStoredProcedureQuery
in interfacejakarta.persistence.EntityManager
- Specified by:
createStoredProcedureQuery
in interfaceSharedSessionContract
- Overrides:
createStoredProcedureQuery
in classAbstractSharedSessionContract
- Parameters:
procedureName
- The name of the procedure.- Returns:
- The representation of the procedure call.
-
createStoredProcedureQuery
public ProcedureCall createStoredProcedureQuery(String procedureName, Class... resultClasses)
Description copied from interface:SharedSessionContract
Create aProcedureCall
to a stored procedure with the given result set entity mappings. Each given class is considered a "root return".- Specified by:
createStoredProcedureQuery
in interfacejakarta.persistence.EntityManager
- Specified by:
createStoredProcedureQuery
in interfaceSharedSessionContract
- Overrides:
createStoredProcedureQuery
in classAbstractSharedSessionContract
- Parameters:
procedureName
- The name of the procedure.resultClasses
- The entity(s) to map the result on to.- Returns:
- The representation of the procedure call.
-
createStoredProcedureQuery
public ProcedureCall createStoredProcedureQuery(String procedureName, String... resultSetMappings)
Description copied from interface:SharedSessionContract
Create aProcedureCall
to a stored procedure with the given result set entity mappings.- Specified by:
createStoredProcedureQuery
in interfacejakarta.persistence.EntityManager
- Specified by:
createStoredProcedureQuery
in interfaceSharedSessionContract
- Overrides:
createStoredProcedureQuery
in classAbstractSharedSessionContract
- Parameters:
procedureName
- The name of the procedure.resultSetMappings
- The explicit result set mapping(s) to use for mapping the results- Returns:
- The representation of the procedure call.
-
joinTransaction
public void joinTransaction()
- Specified by:
joinTransaction
in interfacejakarta.persistence.EntityManager
-
isJoinedToTransaction
public boolean isJoinedToTransaction()
- Specified by:
isJoinedToTransaction
in interfacejakarta.persistence.EntityManager
-
unwrap
public <T> T unwrap(Class<T> clazz)
- Specified by:
unwrap
in interfacejakarta.persistence.EntityManager
-
getDelegate
public Object getDelegate()
- Specified by:
getDelegate
in interfacejakarta.persistence.EntityManager
-
getEntityManagerFactory
public SessionFactoryImplementor getEntityManagerFactory()
- Specified by:
getEntityManagerFactory
in interfacejakarta.persistence.EntityManager
-
getMetamodel
public jakarta.persistence.metamodel.Metamodel getMetamodel()
- Specified by:
getMetamodel
in interfacejakarta.persistence.EntityManager
-
createEntityGraph
public <T> RootGraphImplementor<T> createEntityGraph(Class<T> rootType)
- Specified by:
createEntityGraph
in interfacejakarta.persistence.EntityManager
- Specified by:
createEntityGraph
in interfaceSession
- Specified by:
createEntityGraph
in interfaceSessionImplementor
-
createEntityGraph
public RootGraphImplementor<?> createEntityGraph(String graphName)
- Specified by:
createEntityGraph
in interfacejakarta.persistence.EntityManager
- Specified by:
createEntityGraph
in interfaceSession
- Specified by:
createEntityGraph
in interfaceSessionImplementor
-
getEntityGraph
public RootGraphImplementor<?> getEntityGraph(String graphName)
- Specified by:
getEntityGraph
in interfacejakarta.persistence.EntityManager
- Specified by:
getEntityGraph
in interfaceSession
- Specified by:
getEntityGraph
in interfaceSessionImplementor
-
getEntityGraphs
public <T> List<jakarta.persistence.EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass)
- Specified by:
getEntityGraphs
in interfacejakarta.persistence.EntityManager
- Specified by:
getEntityGraphs
in interfaceSession
-
isEnforcingFetchGraph
public boolean isEnforcingFetchGraph()
- Specified by:
isEnforcingFetchGraph
in interfaceSharedSessionContractImplementor
-
setEnforcingFetchGraph
public void setEnforcingFetchGraph(boolean isEnforcingFetchGraph)
- Specified by:
setEnforcingFetchGraph
in interfaceSharedSessionContractImplementor
-
-