public class JpaUtil
extends java.lang.Object
Applicable to EJB version 3.2.ga or later
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONFIG |
static java.lang.String |
JPA_EM_MAP |
static java.lang.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(java.lang.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(java.lang.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(java.lang.String puName)
Create or return the EntityManagerFactory for the specified persistence
unit name.
|
static javax.persistence.EntityManagerFactory |
getEntityManagerFactory(java.lang.String puName,
java.util.Map properties)
Create the EntityManagerFactory for the specified persistence unit and
defined properties.
|
static javax.persistence.EntityManager |
getEntiyManager(java.lang.String puName,
java.util.Map properties)
Returns an EntityManager for the specified persistence unit name and
defined properties.
|
public static final java.lang.String CONFIG
public static final java.lang.String JPA_EMF_MAP
public static final java.lang.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(java.lang.String puName)
puName
- Persistence unit namepublic static javax.persistence.EntityManagerFactory getEntityManagerFactory(java.lang.String puName, java.util.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(java.lang.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(java.lang.String puName)
public static javax.persistence.EntityManager getEntiyManager(java.lang.String puName, java.util.Map properties)
puName
- -
Persistence unit nameproperties
- -
Defined prioritiesCopyright © 2005-2021 Potix Corporation. All Rights Reserved.