public class SessionHolder extends EntityManagerHolder
Session (plus an optional Transaction).
HibernateTransactionManager binds instances of this class to the thread,
for a given SessionFactory. Extends EntityManagerHolder
as of 5.1, automatically exposing an EntityManager handle on Hibernate 5.2+.
Note: This is an SPI class, not intended to be used by applications.
HibernateTransactionManager,
SessionFactoryUtils| Constructor and Description |
|---|
SessionHolder(org.hibernate.Session session)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the transactional state of this resource holder.
|
org.hibernate.FlushMode |
getPreviousFlushMode() |
org.hibernate.Session |
getSession() |
org.hibernate.Transaction |
getTransaction() |
void |
setPreviousFlushMode(org.hibernate.FlushMode previousFlushMode) |
void |
setTransaction(org.hibernate.Transaction transaction)
Set the associated transaction.
|
getEntityManager, getSavepointManager, isTransactionActive, setSavepointManager, setTransactionActivegetDeadline, getTimeToLiveInMillis, getTimeToLiveInSeconds, hasTimeout, isOpen, isRollbackOnly, isSynchronizedWithTransaction, isVoid, released, requested, reset, resetRollbackOnly, setRollbackOnly, setSynchronizedWithTransaction, setTimeout, setTimeoutInMillis, unboundpublic SessionHolder(org.hibernate.Session session)
session - The sessionpublic org.hibernate.Session getSession()
public void setTransaction(@Nullable
org.hibernate.Transaction transaction)
transaction - The transaction@Nullable public org.hibernate.Transaction getTransaction()
public void setPreviousFlushMode(@Nullable
org.hibernate.FlushMode previousFlushMode)
previousFlushMode - The previous flush mode@Nullable public org.hibernate.FlushMode getPreviousFlushMode()
public void clear()
ResourceHolderSupportclear in class EntityManagerHolder