Jakarta Persistence (JPA) Method

EntityManager createEntityManager(
  SynchronizationType synchronizationType,
  Map<?,?> map
)


Create a new JTA application-managed EntityManager with the specified synchronization type and map of properties. 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
map - properties for entity manager
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