spring-framework / org.springframework.orm.jpa / SharedEntityManagerCreator / <init>

<init>

SharedEntityManagerCreator()

Delegate for creating a shareable JPA javax.persistence.EntityManager reference for a given javax.persistence.EntityManagerFactory.

A shared EntityManager will behave just like an EntityManager fetched from an application server's JNDI environment, as defined by the JPA specification. It will delegate all calls to the current transactional EntityManager, if any; otherwise it will fall back to a newly created EntityManager per operation.

For a behavioral definition of such a shared transactional EntityManager, see javax.persistence.PersistenceContextType#TRANSACTION and its discussion in the JPA spec document. This is also the default being used for the annotation-based javax.persistence.PersistenceContext#type().

Author
Juergen Hoeller

Author
Rod Johnson

Author
Oliver Gierke

Since
2.0

See Also
javax.persistence.PersistenceContextjavax.persistence.PersistenceContextType#TRANSACTIONorg.springframework.orm.jpa.JpaTransactionManagerExtendedEntityManagerCreator