Class FactoryBasedEntityManagerProvider

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

public class FactoryBasedEntityManagerProvider extends Object implements EntityManagerProvider
An implementation of the EntityManagerProvider that returns a new EntityManager instance each time using the EntityManagerFactory.
Since:
5.0.2
Author:
John Hendrikx
  • Constructor Details

    • FactoryBasedEntityManagerProvider

      public FactoryBasedEntityManagerProvider(@Nonnull jakarta.persistence.EntityManagerFactory entityManagerFactory)
      Constructs a new instance.
      Parameters:
      entityManagerFactory - The EntityManagerFactory to use, cannot be null.
  • 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.