org.axonframework.common.jpa
Class SimpleEntityManagerProvider

java.lang.Object
  extended by 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 Summary
SimpleEntityManagerProvider(javax.persistence.EntityManager entityManager)
          Initializes an instance that always returns the given entityManager.
 
Method Summary
 javax.persistence.EntityManager getEntityManager()
          Returns the EntityManager instance to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleEntityManagerProvider

public SimpleEntityManagerProvider(javax.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 Detail

getEntityManager

public javax.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.


Copyright © 2010-2016. All Rights Reserved.