Package io.micronaut.transaction.jpa
Class EntityManagerHolder
- java.lang.Object
-
- io.micronaut.transaction.support.ResourceHolderSupport
-
- io.micronaut.transaction.jpa.EntityManagerHolder
-
- All Implemented Interfaces:
ResourceHolder
- Direct Known Subclasses:
SessionHolder
public class EntityManagerHolder extends ResourceHolderSupport
Resource holder wrapping a JPAEntityManager
.JpaTransactionManager
binds instances of this class to the thread, for a givenEntityManagerFactory
.Also serves as a base class for
SessionHolder
, as of 5.1.Note: This is an SPI class, not intended to be used by applications.
- Since:
- 2.0
- Author:
- Juergen Hoeller, graemerocher
-
-
Constructor Summary
Constructors Constructor Description EntityManagerHolder(javax.persistence.EntityManager entityManager)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear the transactional state of this resource holder.javax.persistence.EntityManager
getEntityManager()
protected SavepointManager
getSavepointManager()
protected boolean
isTransactionActive()
protected void
setSavepointManager(SavepointManager savepointManager)
protected void
setTransactionActive(boolean transactionActive)
-
Methods inherited from class io.micronaut.transaction.support.ResourceHolderSupport
getDeadline, getTimeToLiveInMillis, getTimeToLiveInSeconds, hasTimeout, isOpen, isRollbackOnly, isSynchronizedWithTransaction, isVoid, released, requested, reset, resetRollbackOnly, setRollbackOnly, setSynchronizedWithTransaction, setTimeout, setTimeoutInMillis, unbound
-
-
-
-
Method Detail
-
getEntityManager
@NonNull public javax.persistence.EntityManager getEntityManager()
- Returns:
- The entity manager
-
setTransactionActive
protected void setTransactionActive(boolean transactionActive)
- Parameters:
transactionActive
- Sets the transaction as active.
-
isTransactionActive
protected boolean isTransactionActive()
- Returns:
- Whether the transaction is ative
-
setSavepointManager
protected void setSavepointManager(@Nullable SavepointManager savepointManager)
- Parameters:
savepointManager
- Sets the save point manager
-
getSavepointManager
@Nullable protected SavepointManager getSavepointManager()
- Returns:
- The save point manager
-
clear
public void clear()
Description copied from class:ResourceHolderSupport
Clear the transactional state of this resource holder.- Overrides:
clear
in classResourceHolderSupport
-
-