|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.compass.gps.device.jpa.AbstractEntityManagerWrapper
public abstract class AbstractEntityManagerWrapper
A simple base class for EntityManagerWrapper implementations. Calls the subclasses
for EntityManager, and an optioan EntityTransaction. Takes care of
all the rest.
| Field Summary | |
|---|---|
protected javax.persistence.EntityManager |
entityManager
|
protected javax.persistence.EntityManagerFactory |
entityManagerFactory
|
protected org.apache.commons.logging.Log |
log
|
| Constructor Summary | |
|---|---|
AbstractEntityManagerWrapper()
|
|
| Method Summary | |
|---|---|
protected abstract void |
beginTransaction()
|
void |
close()
Closes the current EntityManager, commiting the transaction if necessary. |
void |
closeOnError()
Closes the current EntityManager, rollback the transaction if necessary. |
protected abstract void |
commitTransaction()
|
protected void |
doCreateEntityManager()
|
javax.persistence.EntityManager |
getEntityManager()
Returns the EntityManager opened by the wrapper open operation. |
EntityManagerWrapper |
newInstance()
Creates a new instance of this entity manager wrapper for multi threaded usage. |
void |
open()
Opens the warpper for a session of reading enteties for indexing. |
protected abstract void |
rollbackTransaction()
|
void |
setUp(javax.persistence.EntityManagerFactory entityManagerFactory)
Sets up the entity manager wrapper with the EntityManagerFactory. |
protected abstract boolean |
shouldCloseEntityManager()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.apache.commons.logging.Log log
protected javax.persistence.EntityManagerFactory entityManagerFactory
protected javax.persistence.EntityManager entityManager
| Constructor Detail |
|---|
public AbstractEntityManagerWrapper()
| Method Detail |
|---|
public void setUp(javax.persistence.EntityManagerFactory entityManagerFactory)
EntityManagerWrapperEntityManagerFactory.
setUp in interface EntityManagerWrapperentityManagerFactory - The EntityManagerFactory the wrapper will usepublic javax.persistence.EntityManager getEntityManager()
EntityManagerWrapperEntityManager opened by the wrapper open operation.
getEntityManager in interface EntityManagerWrapperEntityManager
public void open()
throws JpaGpsDeviceException,
javax.persistence.PersistenceException
EntityManagerWrapper
open in interface EntityManagerWrapperJpaGpsDeviceException
javax.persistence.PersistenceException
public void close()
throws JpaGpsDeviceException,
javax.persistence.PersistenceException
EntityManagerWrapperEntityManager, commiting the transaction if necessary.
close in interface EntityManagerWrapperJpaGpsDeviceException
javax.persistence.PersistenceException
public void closeOnError()
throws JpaGpsDeviceException
EntityManagerWrapperEntityManager, rollback the transaction if necessary.
closeOnError in interface EntityManagerWrapperJpaGpsDeviceExceptionpublic EntityManagerWrapper newInstance()
EntityManagerWrapper
newInstance in interface EntityManagerWrapper
protected void doCreateEntityManager()
throws javax.persistence.PersistenceException
javax.persistence.PersistenceException
protected abstract void beginTransaction()
throws javax.persistence.PersistenceException
javax.persistence.PersistenceException
protected abstract void commitTransaction()
throws javax.persistence.PersistenceException
javax.persistence.PersistenceException
protected abstract void rollbackTransaction()
throws javax.persistence.PersistenceException
javax.persistence.PersistenceExceptionprotected abstract boolean shouldCloseEntityManager()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||