Class EntityManagerHolder

  • All Implemented Interfaces:
    ResourceHolder
    Direct Known Subclasses:
    SessionHolder

    public class EntityManagerHolder
    extends ResourceHolderSupport
    Resource holder wrapping a JPA EntityManager. JpaTransactionManager binds instances of this class to the thread, for a given EntityManagerFactory.

    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 Detail

      • EntityManagerHolder

        public EntityManagerHolder​(@Nullable
                                   javax.persistence.EntityManager entityManager)
        Default constructor.
        Parameters:
        entityManager - The entity manager
    • 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