Class PersistenceEntityManagerRegistry


  • public class PersistenceEntityManagerRegistry
    extends java.lang.Object
    PersistenceEntityManagerRegistry: register PersistenceEntityManager implementation classes and JPAEntityManagerAccessor instances.
    Since:
    4.2
    • Constructor Detail

      • PersistenceEntityManagerRegistry

        public PersistenceEntityManagerRegistry()
    • Method Detail

      • register

        public static void register​(boolean jta,
                                    JPAEntityManagerAccessor jpaEntityManagerAccessor)
        Register a JPAEntityManagerAccessor instance.
        Parameters:
        jta - whether it is JTA or resource local.
        jpaEntityManagerAccessor - JPAEntityManagerAccessor instance
        Since:
        5.17
      • getJPAEntityManagerAccessor

        public static JPAEntityManagerAccessor getJPAEntityManagerAccessor​(boolean jta,
                                                                           boolean errorIfNotFound)
        Get the registered JPAEntityManagerAccessor instance.
        Parameters:
        jta - whether it is JTA or resource local.
        errorIfNotFound - whether to throw exception if not registered for JTA
        Returns:
        JPAEntityManagerAccessor instance
        Throws:
        SystemRuntimeException - throw if it is not registered for JTA and errorIfNotFound is true. For resource local, return default if not registered.
        Since:
        5.17
      • register

        public static <T extends PersistenceEntityManager> void register​(java.lang.Class<T> persistenceEntityManagerInterface,
                                                                         java.lang.Class<? extends T> persistenceEntityManagerImplClass)
        Register PersistenceEntityManager implementation.
        Parameters:
        persistenceEntityManagerInterface - interface
        persistenceEntityManagerImplClass - implementation class
      • instantiate

        public static <T extends PersistenceEntityManager> T instantiate​(java.lang.Class<T> persistenceEntityManagerInterface,
                                                                         QueryDescriptor queryDescriptor)
        Create a PersistenceEntityManager instance.
        Parameters:
        persistenceEntityManagerInterface - PersistenceEntityManager type. If null, default to PersistenceEntityManager.
        queryDescriptor - query descriptor
        Returns:
        persistenceEntityManager instance.
        Throws:
        SystemRuntimeException - throw if the implementation class is not registered
        Since:
        5.14