spring-framework / org.springframework.orm.jpa / SharedEntityManagerCreator / createSharedEntityManager

createSharedEntityManager

open static fun createSharedEntityManager(emf: EntityManagerFactory): EntityManager

Create a transactional EntityManager proxy for the given EntityManagerFactory.

Parameters

emf - the EntityManagerFactory to delegate to.

Return
a shareable transaction EntityManager proxy

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

Create a transactional EntityManager proxy for the given EntityManagerFactory.

Parameters

emf - the EntityManagerFactory to delegate to.

properties - the properties to be passed into the createEntityManager call (may be null)

Return
a shareable transaction EntityManager proxy

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

Create a transactional EntityManager proxy for the given EntityManagerFactory.

Parameters

emf - the EntityManagerFactory to delegate to.

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 shareable transaction EntityManager proxy

Since
4.0

open static fun createSharedEntityManager(emf: EntityManagerFactory, @Nullable properties: MutableMap<*, *>, vararg entityManagerInterfaces: Class<*>): EntityManager

Create a transactional EntityManager proxy for the given EntityManagerFactory.

Parameters

emf - EntityManagerFactory to obtain EntityManagers from as needed

properties - the properties to be passed into the createEntityManager call (may be null)

entityManagerInterfaces - the interfaces to be implemented by the EntityManager. Allows the addition or specification of proprietary interfaces.

Return
a shareable transactional EntityManager proxy

open static fun createSharedEntityManager(emf: EntityManagerFactory, @Nullable properties: MutableMap<*, *>, synchronizedWithTransaction: Boolean, vararg entityManagerInterfaces: Class<*>): EntityManager

Create a transactional EntityManager proxy for the given EntityManagerFactory.

Parameters

emf - EntityManagerFactory to obtain EntityManagers from as needed

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)

entityManagerInterfaces - the interfaces to be implemented by the EntityManager. Allows the addition or specification of proprietary interfaces.

Return
a shareable transactional EntityManager proxy

Since
4.0