Class SharedEntityManagerCreator

    • Method Detail

      • createSharedEntityManager

        public static EntityManager createSharedEntityManager​(EntityManagerFactory emf)
        Create a transactional EntityManager proxy for the given EntityManagerFactory.
        Parameters:
        emf - the EntityManagerFactory to delegate to.
        Returns:
        a shareable transaction EntityManager proxy
      • createSharedEntityManager

        public static EntityManager createSharedEntityManager​(EntityManagerFactory emf,
                                                              Map<?,​?> properties)
        Create a transactional EntityManager proxy for the given EntityManagerFactory.
        Parameters:
        emf - the EntityManagerFactory to delegate to.
        properties - the properties to be passed into the createEntityManager call (may be null)
        Returns:
        a shareable transaction EntityManager proxy
      • createSharedEntityManager

        public static EntityManager createSharedEntityManager​(EntityManagerFactory emf,
                                                              Map<?,​?> properties,
                                                              boolean synchronizedWithTransaction)
        Create a transactional EntityManager proxy for the given EntityManagerFactory.
        Parameters:
        emf - the EntityManagerFactory to delegate to.
        properties - the properties to be passed into the createEntityManager call (may be null)
        synchronizedWithTransaction - whether to automatically join ongoing transactions (according to the JPA 2.1 SynchronizationType rules)
        Returns:
        a shareable transaction EntityManager proxy
        Since:
        4.0
      • createSharedEntityManager

        public static EntityManager createSharedEntityManager​(EntityManagerFactory emf,
                                                              Map<?,​?> properties,
                                                              Class<?>... entityManagerInterfaces)
        Create a transactional EntityManager proxy for the given EntityManagerFactory.
        Parameters:
        emf - the EntityManagerFactory to obtain EntityManagers from as needed
        properties - the properties to be passed into the createEntityManager call (may be null)
        entityManagerInterfaces - the interfaces to be implemented by the EntityManager. Allows the addition or specification of proprietary interfaces.
        Returns:
        a shareable transactional EntityManager proxy
      • createSharedEntityManager

        public static EntityManager createSharedEntityManager​(EntityManagerFactory emf,
                                                              Map<?,​?> properties,
                                                              boolean synchronizedWithTransaction,
                                                              Class<?>... entityManagerInterfaces)
        Create a transactional EntityManager proxy for the given EntityManagerFactory.
        Parameters:
        emf - the EntityManagerFactory to obtain EntityManagers from as needed
        properties - the properties to be passed into the createEntityManager call (may be null)
        synchronizedWithTransaction - whether to automatically join ongoing transactions (according to the JPA 2.1 SynchronizationType rules)
        entityManagerInterfaces - the interfaces to be implemented by the EntityManager. Allows the addition or specification of proprietary interfaces.
        Returns:
        a shareable transactional EntityManager proxy
        Since:
        4.0