public abstract class ExtendedEntityManagerCreator extends Object
Supports explicit joining of a transaction through the
joinTransaction()
method ("application-managed extended
EntityManager") as well as automatic joining on each operation
("container-managed extended EntityManager").
Constructor and Description |
---|
ExtendedEntityManagerCreator() |
Modifier and Type | Method and Description |
---|---|
static EntityManager |
createApplicationManagedEntityManager(EntityManager rawEntityManager,
EntityManagerFactoryInfo emfInfo)
Create an EntityManager that can join transactions with the
joinTransaction()
method, but is not automatically managed by the container. |
static EntityManager |
createApplicationManagedEntityManager(EntityManager rawEntityManager,
EntityManagerFactoryInfo emfInfo,
boolean synchronizedWithTransaction)
Create an EntityManager that can join transactions with the
joinTransaction()
method, but is not automatically managed by the container. |
static EntityManager |
createContainerManagedEntityManager(EntityManager rawEntityManager,
EntityManagerFactoryInfo emfInfo)
Create an EntityManager whose lifecycle is managed by the container and which
automatically joins a transaction when being invoked within its scope.
|
static EntityManager |
createContainerManagedEntityManager(EntityManagerFactory emf)
Create an EntityManager whose lifecycle is managed by the container and which
automatically joins a transaction when being invoked within its scope.
|
static EntityManager |
createContainerManagedEntityManager(EntityManagerFactory emf,
Map<?,?> properties)
Create an EntityManager whose lifecycle is managed by the container and which
automatically joins a transaction when being invoked within its scope.
|
static EntityManager |
createContainerManagedEntityManager(EntityManagerFactory emf,
Map<?,?> properties,
boolean synchronizedWithTransaction)
Create an EntityManager whose lifecycle is managed by the container and which
may automatically join a transaction when being invoked within its scope.
|
public static EntityManager createApplicationManagedEntityManager(EntityManager rawEntityManager, EntityManagerFactoryInfo emfInfo)
joinTransaction()
method, but is not automatically managed by the container.rawEntityManager
- raw EntityManageremfInfo
- the EntityManagerFactoryInfo to obtain the JpaDialect
and PersistenceUnitInfo frompublic static EntityManager createApplicationManagedEntityManager(EntityManager rawEntityManager, EntityManagerFactoryInfo emfInfo, boolean synchronizedWithTransaction)
joinTransaction()
method, but is not automatically managed by the container.rawEntityManager
- raw EntityManageremfInfo
- the EntityManagerFactoryInfo to obtain the JpaDialect
and PersistenceUnitInfo fromsynchronizedWithTransaction
- whether to automatically join ongoing
transactions (according to the JPA 2.1 SynchronizationType rules)public static EntityManager createContainerManagedEntityManager(EntityManager rawEntityManager, EntityManagerFactoryInfo emfInfo)
rawEntityManager
- raw EntityManageremfInfo
- the EntityManagerFactoryInfo to obtain the JpaDialect
and PersistenceUnitInfo frompublic static EntityManager createContainerManagedEntityManager(EntityManagerFactory emf)
emf
- the EntityManagerFactory to create the EntityManager with.
If this implements the EntityManagerFactoryInfo interface, the corresponding
JpaDialect and PersistenceUnitInfo will be detected accordingly.EntityManagerFactory.createEntityManager()
public static EntityManager createContainerManagedEntityManager(EntityManagerFactory emf, Map<?,?> properties)
emf
- the EntityManagerFactory to create the EntityManager with.
If this implements the EntityManagerFactoryInfo interface, the corresponding
JpaDialect and PersistenceUnitInfo will be detected accordingly.properties
- the properties to be passed into the createEntityManager
call (may be null
)EntityManagerFactory.createEntityManager(java.util.Map)
public static EntityManager createContainerManagedEntityManager(EntityManagerFactory emf, Map<?,?> properties, boolean synchronizedWithTransaction)
emf
- the EntityManagerFactory to create the EntityManager with.
If this implements the EntityManagerFactoryInfo interface, the corresponding
JpaDialect and PersistenceUnitInfo will be detected accordingly.properties
- the properties to be passed into the createEntityManager
call (may be null
)synchronizedWithTransaction
- whether to automatically join ongoing
transactions (according to the JPA 2.1 SynchronizationType rules)EntityManagerFactory.createEntityManager(java.util.Map)