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

createContainerManagedEntityManager

open static fun createContainerManagedEntityManager(rawEntityManager: EntityManager, emfInfo: EntityManagerFactoryInfo): EntityManager

Create a container-managed extended EntityManager proxy.

Parameters

rawEntityManager - the raw EntityManager to decorate

emfInfo - the EntityManagerFactoryInfo to obtain the JpaDialect and PersistenceUnitInfo from

Return
a container-managed EntityManager that will automatically participate in any managed transaction

open static fun createContainerManagedEntityManager(emf: EntityManagerFactory): EntityManager

Create a container-managed extended EntityManager proxy.

Parameters

emf - the EntityManagerFactory to create the EntityManager with. If this implements the EntityManagerFactoryInfo interface, the corresponding JpaDialect and PersistenceUnitInfo will be detected accordingly.

Return
a container-managed EntityManager that will automatically participate in any managed transaction

See Also
javax.persistence.EntityManagerFactory#createEntityManager()

open static fun createContainerManagedEntityManager(emf: EntityManagerFactory, @Nullable properties: MutableMap<*, *>): EntityManager

Create a container-managed extended EntityManager proxy.

Parameters

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)

Return
a container-managed EntityManager that will automatically participate in any managed transaction

See Also
javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)

open static fun createContainerManagedEntityManager(emf: EntityManagerFactory, @Nullable properties: MutableMap<*, *>, synchronizedWithTransaction: Boolean): EntityManager

Create a container-managed extended EntityManager proxy.

Parameters

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)

Return
a container-managed EntityManager that expects container-driven lifecycle management but may opt out of automatic transaction synchronization

See Also
javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)

Since
4.0