public final class JpaHelper extends Object
Modifier and Type | Method and Description |
---|---|
static javax.persistence.EntityManager |
getTargetEntityManager(org.apache.camel.Exchange exchange,
javax.persistence.EntityManagerFactory entityManagerFactory,
boolean usePassedInEntityManager,
boolean useSharedEntityManager,
boolean allowRecreate)
Gets or creates an
EntityManager to use. |
public static javax.persistence.EntityManager getTargetEntityManager(org.apache.camel.Exchange exchange, javax.persistence.EntityManagerFactory entityManagerFactory, boolean usePassedInEntityManager, boolean useSharedEntityManager, boolean allowRecreate)
EntityManager
to use.exchange
- the current exchange, or null if no exchangeentityManagerFactory
- the entity manager factory (mandatory)usePassedInEntityManager
- whether to use an existing EntityManager
which has been stored
on the exchange in the header with key JpaConstants.ENTITY_MANAGER
useSharedEntityManager
- whether to use SharedEntityManagerCreator if not already passed inApache Camel