The Spring Framework

org.springframework.orm.jpa
Class SharedEntityManagerCreator

java.lang.Object
  extended by org.springframework.orm.jpa.SharedEntityManagerCreator

public abstract class SharedEntityManagerCreator
extends Object

Factory for a shared JPA EntityManager for a given EntityManagerFactory.

The shared EntityManager will behave just like an EntityManager fetched from an application server's JNDI environment, as defined by the JPA specification. It will delegate all calls to the current transactional EntityManager, if any; else, it will fall back to a newly created EntityManager per operation.

Since:
2.0
Author:
Juergen Hoeller, Rod Johnson
See Also:
LocalEntityManagerFactoryBean, JpaTransactionManager

Constructor Summary
SharedEntityManagerCreator()
           
 
Method Summary
static javax.persistence.EntityManager createSharedEntityManager(javax.persistence.EntityManagerFactory emf)
          Create a shared transactional EntityManager proxy, given this EntityManagerFactory
static javax.persistence.EntityManager createSharedEntityManager(javax.persistence.EntityManagerFactory emf, Map properties)
          Create a shared transactional EntityManager proxy, given this EntityManagerFactory
static javax.persistence.EntityManager createSharedEntityManager(javax.persistence.EntityManagerFactory emf, Map properties, Class... entityManagerInterfaces)
          Create a shared transactional EntityManager proxy, given this EntityManagerFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedEntityManagerCreator

public SharedEntityManagerCreator()
Method Detail

createSharedEntityManager

public static javax.persistence.EntityManager createSharedEntityManager(javax.persistence.EntityManagerFactory emf)
Create a shared transactional EntityManager proxy, given this EntityManagerFactory

Parameters:
emf - the EntityManagerFactory to delegate to. If this implements the EntityManagerFactoryInfo interface, appropriate handling of the native EntityManagerFactory and available EntityManagerPlusOperations will automatically apply.
Returns:
a shareable transaction EntityManager proxy

createSharedEntityManager

public static javax.persistence.EntityManager createSharedEntityManager(javax.persistence.EntityManagerFactory emf,
                                                                        Map properties)
Create a shared transactional EntityManager proxy, given this EntityManagerFactory

Parameters:
emf - the EntityManagerFactory to delegate to. If this implements the EntityManagerFactoryInfo interface, appropriate handling of the native EntityManagerFactory and available EntityManagerPlusOperations will automatically apply.
properties - the properties to be passed into the createEntityManager call (may be null)
Returns:
a shareable transaction EntityManager proxy

createSharedEntityManager

public static javax.persistence.EntityManager createSharedEntityManager(javax.persistence.EntityManagerFactory emf,
                                                                        Map properties,
                                                                        Class... entityManagerInterfaces)
Create a shared transactional EntityManager proxy, given this EntityManagerFactory

Parameters:
emf - EntityManagerFactory to obtain EntityManagers from as needed
properties - the properties to be passed into the createEntityManager call (may be null)
entityManagerInterfaces - interfaces to be implemented by the EntityManager. Allows the addition or specification of proprietary interfaces.
Returns:
a shareable transaction EntityManager proxy

The Spring Framework

Copyright © 2002-2007 The Spring Framework.