|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.easyweb4j.repository.RepositoryManager
public class RepositoryManager
A repository manager instance manages singleton instances of the different repositories required by the controllers. The singleton instance of the repositories are created lazily when required by the controller handling the request.
Constructor Summary | |
---|---|
RepositoryManager(Map<Class<?>,PersistenceManager> persistenceManagers,
Map<Class<?>,PersistenceContextManager> persistenceContextManagers)
Initializes the repository map, builds the SessionFactory and EntityManagerFactory if appropriate configuration files are found.. |
Method Summary | |
---|---|
void |
closePersistence()
Closes the SessionFactory and the EntityManagerFactory of the application. |
void |
closePersistenceContext()
Closes the Hibernate session and JPA EntityManager for the current thread. |
void |
commit()
Commits the transaction, if a transaction is currently active. |
void |
ensureTransaction()
Begins a transaction. |
Repository<?> |
getRepository(Class<Repository<?>> repositoryClass)
Retrieves an instance of the given repository class from the available repositories or creates a new instance. |
void |
markAsReadOnly()
Sets the FlushMode of current Session to MANUAL and FlushModeType of current EntityManager to COMMIT. |
void |
rollback()
Rolls back the transaction, if a transaction is currently active. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RepositoryManager(Map<Class<?>,PersistenceManager> persistenceManagers, Map<Class<?>,PersistenceContextManager> persistenceContextManagers)
Method Detail |
---|
public void closePersistenceContext()
public void ensureTransaction()
public void commit()
public void rollback()
public void markAsReadOnly()
public void closePersistence()
public Repository<?> getRepository(Class<Repository<?>> repositoryClass)
getRepository
in interface RepositoryProvider
repositoryClass
- The class of the repository to be retrieved.
IllegalAccessException
- - If creation of new repository fails.
NoSuchFieldException
- - If creation of new repository fails.
InstantiationException
- - If creation of new repository fails.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |