public class JpaUtil extends Object
Applicable to EJB version 3.2.ga or later
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG |
static String |
JPA_EM_MAP |
static String |
JPA_EMF_MAP |
| Constructor and Description |
|---|
JpaUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeEntityManager()
Closes the EntityManager of the default EntityManagerFactory as
defined in zk.xml in an Execution scope.
|
static void |
closeEntityManager(String puName)
Closes the EntityManager of the EntityManagerFactory of the specified puName;
|
static javax.persistence.EntityManager |
getEntityManager()
Returns an EntityManager of the default EntityManagerFactory as defined in zk.xml in an Execution scope.
|
static javax.persistence.EntityManager |
getEntityManager(String puName)
Returns or create an EntityManager for the specified persistence unit name.
|
static javax.persistence.EntityManagerFactory |
getEntityManagerFactory()
Create or return the default EntityManagerFactory as defined in zk.xml.
|
static javax.persistence.EntityManagerFactory |
getEntityManagerFactory(String puName)
Create or return the EntityManagerFactory for the specified persistence
unit name.
|
static javax.persistence.EntityManagerFactory |
getEntityManagerFactory(String puName,
Map properties)
Create the EntityManagerFactory for the specified persistence unit and
defined properties.
|
static javax.persistence.EntityManager |
getEntiyManager(String puName,
Map properties)
Returns an EntityManager for the specified persistence unit name and
defined properties.
|
public static final String CONFIG
public static final String JPA_EMF_MAP
public static final String JPA_EM_MAP
public static javax.persistence.EntityManagerFactory getEntityManagerFactory()
In WEB-INF/zk.xml, add following lines:
<preference>
<name>JPA.PersistenceUnitName</name>
<value>PERSISTENCE_UNIT_NAME</value>
</preference>
public static javax.persistence.EntityManagerFactory getEntityManagerFactory(String puName)
puName - Persistence unit namepublic static javax.persistence.EntityManagerFactory getEntityManagerFactory(String puName, Map properties)
puName - Persistence unit nameproperties - Defined prioritiespublic static javax.persistence.EntityManager getEntityManager()
In WEB-INF/zk.xml, add following lines:
<preference>
<name>JPA.PersistenceUnitName</name>
<value>PERSISTENCE_UNIT_NAME</value>
</preference>
public static javax.persistence.EntityManager getEntityManager(String puName)
The EntityManager get by this method is guaranteed to be the same within one Execution for the specified persistence unit name.
puName - -
Persistence unit namepublic static void closeEntityManager()
In WEB-INF/zk.xml, add following lines:
<preference>
<name>JPA.PersistenceUnitName</name>
<value>PERSISTENCE_UNIT_NAME</value>
</preference>
public static void closeEntityManager(String puName)
public static javax.persistence.EntityManager getEntiyManager(String puName, Map properties)
puName - -
Persistence unit nameproperties - -
Defined prioritiesCopyright © 2019. All rights reserved.