Class EntityManagerService

java.lang.Object
org.exoplatform.commons.persistence.impl.EntityManagerService
All Implemented Interfaces:
org.exoplatform.container.component.ComponentRequestLifecycle

public class EntityManagerService extends Object implements org.exoplatform.container.component.ComponentRequestLifecycle
This service is responsible to create a single EntityManagerFactory, with the persistence unit name meeds-jpa.

The service is also bound to use of the RequestLifecycle that there is only one EntityManager will be created at beginning of the request lifecycle. The EntityManager instance will be maintained open and shared with all applications relying on this through to the end of lifecycle.

Version:
$Revision$
Author:
Trong Tran
  • Field Details

    • PERSISTENCE_UNIT_NAME

      public static final String PERSISTENCE_UNIT_NAME
      See Also:
    • entityManagerFactory

      protected jakarta.persistence.EntityManagerFactory entityManagerFactory
    • properties

      protected Properties properties
  • Constructor Details

    • EntityManagerService

      public EntityManagerService()
    • EntityManagerService

      public EntityManagerService(jakarta.persistence.EntityManagerFactory managerFactory, Properties props)
  • Method Details

    • getDatasourceName

      public String getDatasourceName()
    • setDatasourceName

      public void setDatasourceName(String datasourceName)
    • getEntityManager

      public jakarta.persistence.EntityManager getEntityManager()
      Returns:
      the EntityManager instance available in current request lifecycle. Otherwise, it returns NULL.
    • startRequest

      public void startRequest(org.exoplatform.container.ExoContainer container)
      Specified by:
      startRequest in interface org.exoplatform.container.component.ComponentRequestLifecycle
    • endRequest

      public void endRequest(org.exoplatform.container.ExoContainer container)
      Specified by:
      endRequest in interface org.exoplatform.container.component.ComponentRequestLifecycle
    • isStarted

      public boolean isStarted(org.exoplatform.container.ExoContainer container)
      Specified by:
      isStarted in interface org.exoplatform.container.component.ComponentRequestLifecycle
    • getPersistenceUnitName

      public String getPersistenceUnitName()