org.axonframework.common.jpa
Class ContainerManagedEntityManagerProvider

java.lang.Object
  extended by org.axonframework.common.jpa.ContainerManagedEntityManagerProvider
All Implemented Interfaces:
EntityManagerProvider

public class ContainerManagedEntityManagerProvider
extends Object
implements EntityManagerProvider

EntityManagerProvider implementation that expects the container to inject the default container managed EntityManager instance. This implementation expects the container to have exactly one PersistenceUnit, or provide a default if no explicit Persistence Unit Name is provided.

Since:
1.3
Author:
Allard Buijze
See Also:
PersistenceContext, EntityManager

Constructor Summary
ContainerManagedEntityManagerProvider()
           
 
Method Summary
 javax.persistence.EntityManager getEntityManager()
          Returns the EntityManager instance to use.
 void setEntityManager(javax.persistence.EntityManager entityManager)
          Sets the container managed entityManager to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContainerManagedEntityManagerProvider

public ContainerManagedEntityManagerProvider()
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.

setEntityManager

public void setEntityManager(javax.persistence.EntityManager entityManager)
Sets the container managed entityManager to use. Is generally injected by the application container.

Parameters:
entityManager - the entityManager to return upon request.


Copyright © 2010-2016. All Rights Reserved.