spring-framework / org.springframework.orm.jpa / ExtendedEntityManagerCreator

ExtendedEntityManagerCreator

abstract class ExtendedEntityManagerCreator

Delegate for creating a variety of javax.persistence.EntityManager proxies that follow the JPA spec's semantics for "extended" EntityManagers.

Supports several different variants of "extended" EntityManagers: in particular, an "application-managed extended EntityManager", as defined by javax.persistence.EntityManagerFactory#createEntityManager(), as well as a "container-managed extended EntityManager", as defined by javax.persistence.PersistenceContextType#EXTENDED.

The original difference between "application-managed" and "container-managed" was the need for explicit joining of an externally managed transaction through the EntityManager#joinTransaction() method in the "application" case versus the automatic joining on each user-level EntityManager operation in the "container" case. As of JPA 2.1, both join modes are available with both kinds of EntityManagers, so the difference between "application-" and "container-managed" is now primarily in the join mode default and in the restricted lifecycle of a container-managed EntityManager (i.e. tied to the object that it is injected into).

Author
Juergen Hoeller

Author
Rod Johnson

Since
2.0

See Also
javax.persistence.EntityManagerFactory#createEntityManager()javax.persistence.PersistenceContextType#EXTENDEDjavax.persistence.EntityManager#joinTransaction()SharedEntityManagerCreator

Constructors

<init>

ExtendedEntityManagerCreator()

Delegate for creating a variety of javax.persistence.EntityManager proxies that follow the JPA spec's semantics for "extended" EntityManagers.

Supports several different variants of "extended" EntityManagers: in particular, an "application-managed extended EntityManager", as defined by javax.persistence.EntityManagerFactory#createEntityManager(), as well as a "container-managed extended EntityManager", as defined by javax.persistence.PersistenceContextType#EXTENDED.

The original difference between "application-managed" and "container-managed" was the need for explicit joining of an externally managed transaction through the EntityManager#joinTransaction() method in the "application" case versus the automatic joining on each user-level EntityManager operation in the "container" case. As of JPA 2.1, both join modes are available with both kinds of EntityManagers, so the difference between "application-" and "container-managed" is now primarily in the join mode default and in the restricted lifecycle of a container-managed EntityManager (i.e. tied to the object that it is injected into).

Functions

createApplicationManagedEntityManager

open static fun createApplicationManagedEntityManager(rawEntityManager: EntityManager, emfInfo: EntityManagerFactoryInfo): EntityManager
open static fun createApplicationManagedEntityManager(rawEntityManager: EntityManager, emfInfo: EntityManagerFactoryInfo, synchronizedWithTransaction: Boolean): EntityManager

Create an application-managed extended EntityManager proxy.

createContainerManagedEntityManager

open static fun createContainerManagedEntityManager(rawEntityManager: EntityManager, emfInfo: EntityManagerFactoryInfo): EntityManager
open static fun createContainerManagedEntityManager(emf: EntityManagerFactory): EntityManager
open static fun createContainerManagedEntityManager(emf: EntityManagerFactory, properties: MutableMap<*, *>): EntityManager
open static fun createContainerManagedEntityManager(emf: EntityManagerFactory, properties: MutableMap<*, *>, synchronizedWithTransaction: Boolean): EntityManager

Create a container-managed extended EntityManager proxy.