EntityManager with the specified synchronization type.">
Jakarta Persistence (JPA) Method

EntityManager createEntityManager(
  SynchronizationType synchronizationType
)


Create a new JTA application-managed EntityManager with the specified synchronization type. This method returns a new EntityManager instance each time it is invoked.

The EntityManager.isOpen method will return true on the returned instance.

Parameters:
synchronizationType - how and when the entity manager should be synchronized with the current JTA transaction
Returns:
entity manager instance.
Throws:
IllegalStateException - if the entity manager factory has been configured for resource-local entity managers or is closed.
Since:
Jakarta Persistence (JPA) 2.1