|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.orm.jpa.SharedEntityManagerCreator
public abstract class SharedEntityManagerCreator
Factory for a shareable JPA javax.persistence.EntityManager
for a given javax.persistence.EntityManagerFactory
.
The shareable 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; otherwise it will fall back to a newly created EntityManager per operation.
LocalEntityManagerFactoryBean
,
JpaTransactionManager
Nested Class Summary | |
---|---|
private static class |
SharedEntityManagerCreator.DeferredQueryInvocationHandler
Invocation handler that handles deferred Query objects created by non-transactional createQuery invocations on a shared EntityManager. |
private static class |
SharedEntityManagerCreator.SharedEntityManagerInvocationHandler
Invocation handler that delegates all calls to the current transactional EntityManager, if any; else, it will fall back to a newly created EntityManager per operation. |
Constructor Summary | |
---|---|
SharedEntityManagerCreator()
|
Method Summary | |
---|---|
static EntityManager |
createSharedEntityManager(EntityManagerFactory emf)
Create a transactional EntityManager proxy for the given EntityManagerFactory. |
static EntityManager |
createSharedEntityManager(EntityManagerFactory emf,
java.util.Map properties)
Create a transactional EntityManager proxy for the given EntityManagerFactory. |
static EntityManager |
createSharedEntityManager(EntityManagerFactory emf,
java.util.Map properties,
java.lang.Class... entityManagerInterfaces)
Create a transactional EntityManager proxy for the given EntityManagerFactory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SharedEntityManagerCreator()
Method Detail |
---|
public static EntityManager createSharedEntityManager(EntityManagerFactory emf)
emf
- the EntityManagerFactory to delegate to.
If this implements the EntityManagerFactoryInfo
interface,
appropriate handling of the native EntityManagerFactory and available
EntityManagerPlusOperations
will automatically apply.
public static EntityManager createSharedEntityManager(EntityManagerFactory emf, java.util.Map properties)
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
)
public static EntityManager createSharedEntityManager(EntityManagerFactory emf, java.util.Map properties, java.lang.Class... entityManagerInterfaces)
emf
- EntityManagerFactory to obtain EntityManagers from as neededproperties
- the properties to be passed into the
createEntityManager
call (may be null
)entityManagerInterfaces
- the interfaces to be implemented by the
EntityManager. Allows the addition or specification of proprietary interfaces.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |