public interface HibernateRepository extends UnitOfWorkExecutor, Closeable
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.
|
<T> T executeUnitOfWork(UnitOfWork<T> work)
UnitOfWork
within a single transaction.
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
work
- a UnitOfWork
that should be executed.UnitOfWork
.ExecutionError
- if UnitOfWork.execute()
throws an exception.org.hibernate.Session currentSession()
IllegalStateException
- if no UnitOfWork
is currently executing in this thread.void close()
close
in interface AutoCloseable
close
in interface Closeable
boolean isClosed()
Copyright © 2012-2013. All Rights Reserved.