public class SessionHolder extends EntityManagerHolder
Session
(plus an optional Transaction
).
HibernateTransactionManager
binds instances of this class to the thread,
for a given org.hibernate.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
Modifier and Type | Field and Description |
---|---|
private FlushMode |
previousFlushMode |
private Session |
session |
private Transaction |
transaction |
Constructor and Description |
---|
SessionHolder(Session session) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the transactional state of this resource holder.
|
FlushMode |
getPreviousFlushMode() |
Session |
getSession() |
Transaction |
getTransaction() |
void |
setPreviousFlushMode(FlushMode previousFlushMode) |
void |
setTransaction(Transaction transaction) |
getEntityManager, getSavepointManager, isTransactionActive, setSavepointManager, setTransactionActive
getDeadline, getTimeToLiveInMillis, getTimeToLiveInSeconds, hasTimeout, isOpen, isRollbackOnly, isSynchronizedWithTransaction, isVoid, released, requested, reset, resetRollbackOnly, setRollbackOnly, setSynchronizedWithTransaction, setTimeoutInMillis, setTimeoutInSeconds, unbound
private final Session session
@Nullable private Transaction transaction
@Nullable private FlushMode previousFlushMode
public Session getSession()
public void setTransaction(@Nullable Transaction transaction)
@Nullable public Transaction getTransaction()
public void setPreviousFlushMode(@Nullable FlushMode previousFlushMode)
@Nullable public FlushMode getPreviousFlushMode()
public void clear()
ResourceHolderSupport
clear
in class EntityManagerHolder