|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.zkplus.jpa.JpaUtil
public class JpaUtil
This class is used to create and hold open EntityManagerFactory objects within a Java EE environment.
Applicable to EJB version 3.2.ga or later
Field Summary | |
---|---|
static java.lang.String |
CONFIG
|
static java.lang.String |
JPA_EM_MAP
|
static java.lang.String |
JPA_EMF_MAP
|
Constructor Summary | |
---|---|
JpaUtil()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public JpaUtil()
Method Detail |
---|
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 name
public static javax.persistence.EntityManagerFactory getEntityManagerFactory(java.lang.String puName, java.util.Map properties)
puName
- Persistence unit nameproperties
- Defined priorities
public 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 name
public 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 priorities
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |