Package org.springframework.orm.jpa
Class SharedEntityManagerCreator
java.lang.Object
org.springframework.orm.jpa.SharedEntityManagerCreator
Delegate for creating a shareable JPA
EntityManager
reference for a given EntityManagerFactory
.
A 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; otherwise it will fall back to a newly created EntityManager per operation.
For a behavioral definition of such a shared transactional EntityManager,
see PersistenceContextType.TRANSACTION
and its
discussion in the JPA spec document. This is also the default being used
for the annotation-based PersistenceContext.type()
.
- Since:
- 2.0
- Author:
- Juergen Hoeller, Rod Johnson, Oliver Gierke, Mark Paluch, Sam Brannen
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic EntityManager
Create a transactional EntityManager proxy for the given EntityManagerFactory.static EntityManager
createSharedEntityManager
(EntityManagerFactory emf, Map<?, ?> properties) Create a transactional EntityManager proxy for the given EntityManagerFactory.static EntityManager
createSharedEntityManager
(EntityManagerFactory emf, Map<?, ?> properties, boolean synchronizedWithTransaction) Create a transactional EntityManager proxy for the given EntityManagerFactory.static EntityManager
createSharedEntityManager
(EntityManagerFactory emf, Map<?, ?> properties, boolean synchronizedWithTransaction, Class<?>... entityManagerInterfaces) Create a transactional EntityManager proxy for the given EntityManagerFactory.static EntityManager
createSharedEntityManager
(EntityManagerFactory emf, Map<?, ?> properties, Class<?>... entityManagerInterfaces) Create a transactional EntityManager proxy for the given EntityManagerFactory.
-
Constructor Details
-
SharedEntityManagerCreator
public SharedEntityManagerCreator()
-
-
Method Details