Package org.apache.camel.component.jpa
Class JpaHelper
java.lang.Object
org.apache.camel.component.jpa.JpaHelper
Helper for JPA.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopyEntityManagers(org.apache.camel.Exchange target, org.apache.camel.Exchange source) Copy JpaConstants.ENTITY_MANAGER property from source to target exchange.static jakarta.persistence.EntityManagergetTargetEntityManager(org.apache.camel.Exchange exchange, jakarta.persistence.EntityManagerFactory entityManagerFactory, boolean usePassedInEntityManager, boolean useSharedEntityManager, boolean allowRecreate) Gets or creates anEntityManagerto use.
-
Method Details
-
getTargetEntityManager
public static jakarta.persistence.EntityManager getTargetEntityManager(org.apache.camel.Exchange exchange, jakarta.persistence.EntityManagerFactory entityManagerFactory, boolean usePassedInEntityManager, boolean useSharedEntityManager, boolean allowRecreate) Gets or creates anEntityManagerto use.- Parameters:
exchange- the current exchange, or null if no exchangeentityManagerFactory- the entity manager factory (mandatory)usePassedInEntityManager- whether to use an existingEntityManagerwhich has been stored on the exchange in the header with keyJpaConstants.ENTITY_MANAGERuseSharedEntityManager- whether to use SharedEntityManagerCreator if not already passed in- Returns:
- the entity manager (is never null)
-
copyEntityManagers
public static void copyEntityManagers(org.apache.camel.Exchange target, org.apache.camel.Exchange source) Copy JpaConstants.ENTITY_MANAGER property from source to target exchange.- Parameters:
target- The target exchangesource- The source exchange
-