Class JpaHelper

java.lang.Object
org.apache.camel.component.jpa.JpaHelper

public final class JpaHelper extends Object
Helper for JPA.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    copyEntityManagers(org.apache.camel.Exchange target, org.apache.camel.Exchange source)
    Copy JpaConstants.ENTITY_MANAGER property from source to target exchange.
    static jakarta.persistence.EntityManager
    getTargetEntityManager(org.apache.camel.Exchange exchange, jakarta.persistence.EntityManagerFactory entityManagerFactory, boolean usePassedInEntityManager, boolean useSharedEntityManager, boolean allowRecreate)
    Gets or creates an EntityManager to use.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 an EntityManager to use.
      Parameters:
      exchange - the current exchange, or null if no exchange
      entityManagerFactory - 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 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 exchange
      source - The source exchange