Class SimpleEntityManagerProvider

java.lang.Object
org.axonframework.common.jpa.SimpleEntityManagerProvider
All Implemented Interfaces:
EntityManagerProvider

public class SimpleEntityManagerProvider extends Object implements EntityManagerProvider
Simple implementation of the EntityManagerProvider that returns the EntityManager instance provided at construction time.
Since:
1.3
Author:
Allard Buijze
  • Constructor Details

    • SimpleEntityManagerProvider

      public SimpleEntityManagerProvider(jakarta.persistence.EntityManager entityManager)
      Initializes an instance that always returns the given entityManager. This class can be used for testing, or when using a ContainerManaged EntityManager.
      Parameters:
      entityManager - the EntityManager to return on getEntityManager()
  • Method Details

    • getEntityManager

      public jakarta.persistence.EntityManager getEntityManager()
      Description copied from interface: EntityManagerProvider
      Returns the EntityManager instance to use.

      Note that the implementation is responsible for keeping track of transaction scope, if necessary. Generally, this is the case when using application-managed EntityManagers.

      Specified by:
      getEntityManager in interface EntityManagerProvider
      Returns:
      the EntityManager instance to use.