|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectajax.database.HibernateFactory
public class HibernateFactory
This is the Hibernate Entity Manager factory for the entire application. This class maintains a single EntityManager object that can be retrieved and used througout the application such that persistant classes will remain connected (non-transient).
| Field Summary | |
|---|---|
static java.lang.ThreadLocal<javax.persistence.EntityManager> |
em
The single entity manager for this application instance |
static javax.persistence.EntityManagerFactory |
emf
The entity manager factory for generating entity manager |
| Constructor Summary | |
|---|---|
HibernateFactory()
|
|
| Method Summary | |
|---|---|
static void |
closeSession()
Close the currently opened EntityManger |
static void |
commit(org.hibernate.Transaction tx)
This is a simple method to reduce the amount of code that needs to be written every time hibernate is used. |
static javax.persistence.EntityManagerFactory |
getEmf()
|
static javax.persistence.EntityManager |
getSession()
Retrieve or create the entity manager |
static void |
rollback(org.hibernate.Transaction tx)
This is a simple method to reduce the amount of code that needs to be written every time hibernate is used. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final javax.persistence.EntityManagerFactory emf
public static final java.lang.ThreadLocal<javax.persistence.EntityManager> em
| Constructor Detail |
|---|
public HibernateFactory()
| Method Detail |
|---|
public static javax.persistence.EntityManager getSession()
throws org.hibernate.HibernateException
org.hibernate.HibernateException - If there is a problem
public static void closeSession()
throws org.hibernate.HibernateException
org.hibernate.HibernateException - If there is a problempublic static javax.persistence.EntityManagerFactory getEmf()
public static void rollback(org.hibernate.Transaction tx)
public static void commit(org.hibernate.Transaction tx)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||