|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.orm.jpa.ExtendedEntityManagerCreator
public abstract class ExtendedEntityManagerCreator
Factory for dynamic EntityManager proxies that follow the JPA spec's semantics for "extended" EntityManagers.
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").
Nested Class Summary | |
---|---|
private static class |
ExtendedEntityManagerCreator.ExtendedEntityManagerInvocationHandler
InvocationHandler for extended EntityManagers as defined in the JPA spec. |
private static class |
ExtendedEntityManagerCreator.ExtendedEntityManagerSynchronization
TransactionSynchronization enlisting an extended EntityManager with a current Spring transaction. |
Constructor Summary | |
---|---|
ExtendedEntityManagerCreator()
|
Method Summary | |
---|---|
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,
EntityManagerPlusOperations plusOperations)
Create an EntityManager that can join transactions with the joinTransaction() method, but is not automatically
managed by the container. |
static EntityManager |
createApplicationManagedEntityManager(EntityManager rawEntityManager,
EntityManagerPlusOperations plusOperations,
PersistenceExceptionTranslator exceptionTranslator)
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 that automatically joins transactions on each operation in a transaction. |
static EntityManager |
createContainerManagedEntityManager(EntityManager rawEntityManager,
EntityManagerPlusOperations plusOperations)
Create an EntityManager that automatically joins transactions on each operation in a transaction. |
static EntityManager |
createContainerManagedEntityManager(EntityManager rawEntityManager,
EntityManagerPlusOperations plusOperations,
PersistenceExceptionTranslator exceptionTranslator)
Create an EntityManager that automatically joins transactions on each operation in a transaction. |
static EntityManager |
createContainerManagedEntityManager(EntityManagerFactory emf)
Create an EntityManager that automatically joins transactions on each operation in a transaction. |
static EntityManager |
createContainerManagedEntityManager(EntityManagerFactory emf,
java.util.Map properties)
Create an EntityManager that automatically joins transactions on each operation in a transaction. |
private static EntityManager |
createProxy(EntityManager rawEm,
java.lang.Class<? extends EntityManager> emIfc,
java.lang.ClassLoader cl,
EntityManagerPlusOperations plusOperations,
PersistenceExceptionTranslator exceptionTranslator,
java.lang.Boolean jta,
boolean containerManaged)
Actually create the EntityManager proxy. |
private static EntityManager |
createProxy(EntityManager rawEntityManager,
EntityManagerFactoryInfo emfInfo,
boolean containerManaged)
Actually create the EntityManager proxy. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExtendedEntityManagerCreator()
Method Detail |
---|
public static EntityManager createApplicationManagedEntityManager(EntityManager rawEntityManager, EntityManagerPlusOperations plusOperations)
joinTransaction()
method, but is not automatically
managed by the container.
rawEntityManager
- raw EntityManagerplusOperations
- an implementation of the EntityManagerPlusOperations
interface, if those operations should be exposed (may be null
)
public static EntityManager createApplicationManagedEntityManager(EntityManager rawEntityManager, EntityManagerPlusOperations plusOperations, PersistenceExceptionTranslator exceptionTranslator)
joinTransaction()
method, but is not automatically
managed by the container.
rawEntityManager
- raw EntityManagerplusOperations
- an implementation of the EntityManagerPlusOperations
interface, if those operations should be exposed (may be null
)exceptionTranslator
- the exception translator to use for translating
JPA commit/rollback exceptions during transaction synchronization
(may be null
)
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
EntityManagerPlusOperations and PersistenceUnitInfo from
public static EntityManager createContainerManagedEntityManager(EntityManager rawEntityManager, EntityManagerPlusOperations plusOperations)
rawEntityManager
- raw EntityManagerplusOperations
- an implementation of the EntityManagerPlusOperations
interface, if those operations should be exposed (may be null
)
public static EntityManager createContainerManagedEntityManager(EntityManager rawEntityManager, EntityManagerPlusOperations plusOperations, PersistenceExceptionTranslator exceptionTranslator)
rawEntityManager
- raw EntityManagerplusOperations
- an implementation of the EntityManagerPlusOperations
interface, if those operations should be exposed (may be null
)exceptionTranslator
- the exception translator to use for translating
JPA commit/rollback exceptions during transaction synchronization
(may be null
)
public static EntityManager createContainerManagedEntityManager(EntityManager rawEntityManager, EntityManagerFactoryInfo emfInfo)
rawEntityManager
- raw EntityManageremfInfo
- the EntityManagerFactoryInfo to obtain the
EntityManagerPlusOperations and PersistenceUnitInfo from
public static EntityManager createContainerManagedEntityManager(EntityManagerFactory emf)
emf
- the EntityManagerFactory to create the EntityManager with.
If this implements the EntityManagerFactoryInfo interface, appropriate handling
of the native EntityManagerFactory and available EntityManagerPlusOperations
will automatically apply.
javax.persistence.EntityManagerFactory#createEntityManager()
public static EntityManager createContainerManagedEntityManager(EntityManagerFactory emf, java.util.Map properties)
emf
- the EntityManagerFactory to create the EntityManager with.
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
)
javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
private static EntityManager createProxy(EntityManager rawEntityManager, EntityManagerFactoryInfo emfInfo, boolean containerManaged)
rawEntityManager
- raw EntityManageremfInfo
- the EntityManagerFactoryInfo to obtain the
EntityManagerPlusOperations and PersistenceUnitInfo fromcontainerManaged
- whether to follow container-managed EntityManager
or application-managed EntityManager semantics
private static EntityManager createProxy(EntityManager rawEm, java.lang.Class<? extends EntityManager> emIfc, java.lang.ClassLoader cl, EntityManagerPlusOperations plusOperations, PersistenceExceptionTranslator exceptionTranslator, java.lang.Boolean jta, boolean containerManaged)
rawEm
- raw EntityManageremIfc
- the (potentially vendor-specific) EntityManager
interface to proxy, or null
for default detection of all interfacesplusOperations
- an implementation of the EntityManagerPlusOperations
interface, if those operations should be exposed (may be null
)exceptionTranslator
- the PersistenceException translator to usejta
- whether to create a JTA-aware EntityManager
(or null
if not known in advance)containerManaged
- whether to follow container-managed EntityManager
or application-managed EntityManager semantics
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |