@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)
HibernateRepository
UnitOfWork
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 UnitOfWorkExecutor
executeUnitOfWork
in interface HibernateRepository
work
- a UnitOfWork
that should be executed.UnitOfWork
.public void close()
HibernateRepository
close
in interface HibernateRepository
close
in interface Closeable
close
in interface AutoCloseable
public boolean isClosed()
HibernateRepository
isClosed
in interface HibernateRepository
public org.hibernate.Session currentSession()
HibernateRepository
currentSession
in interface HibernateRepository
Copyright © 2012-2013. All Rights Reserved.