@ThreadSafe public class DefaultHibernateRepository extends Object implements HibernateRepository
HibernateRepository implementation.| Constructor and Description |
|---|
DefaultHibernateRepository(HibernateConfiguration hibernateCfg) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the repository (all acquired resources are released).
|
org.hibernate.Session |
currentSession()
Returns the currently open session for this thread.
|
<T> T |
executeUnitOfWork(UnitOfWork<T> work)
Executes the given
UnitOfWork within a single transaction. |
boolean |
isClosed()
Returns true if the repository is closed.
|
@Inject public DefaultHibernateRepository(HibernateConfiguration hibernateCfg)
public <T> T executeUnitOfWork(UnitOfWork<T> work)
HibernateRepositoryUnitOfWork within a single transaction.
HibernateRepository.currentSession() accordingly.UnitOfWork while another UnitOfWork is already executing. However note that
when doing so the Session or the current Transaction is not modified.
executeUnitOfWork in interface UnitOfWorkExecutorexecuteUnitOfWork in interface HibernateRepositorywork - a UnitOfWork that should be executed.UnitOfWork.public void close()
HibernateRepositoryclose in interface HibernateRepositoryclose in interface Closeableclose in interface AutoCloseablepublic boolean isClosed()
HibernateRepositoryisClosed in interface HibernateRepositorypublic org.hibernate.Session currentSession()
HibernateRepositorycurrentSession in interface HibernateRepositoryCopyright © 2012-2013. All Rights Reserved.