@Singleton
public class UnitManager
extends java.lang.Object
implements javax.inject.Provider<org.skife.jdbi.v2.Handle>
Handle for current unit of work. This handle must be used by all JDBI proxies.
Unit of work is thread-bound (all actions in one thread participate in one unit of work).
It is not intended to be used directly (only in really rare cases when manual unit required
without opening transaction).
Raw provider may be injected to obtain current handle: @Inject Provider<Handle>.
In all other cases transaction annotation must be used to wrap code into unit of work using guice aop.
for manual transaction definition| Constructor and Description |
|---|
UnitManager(org.skife.jdbi.v2.DBI dbi) |
| Modifier and Type | Method and Description |
|---|---|
void |
beginUnit()
Starts unit of work.
|
void |
endUnit()
Finish unit of work.
|
org.skife.jdbi.v2.Handle |
get() |
boolean |
isUnitStarted() |
public org.skife.jdbi.v2.Handle get()
get in interface javax.inject.Provider<org.skife.jdbi.v2.Handle>public boolean isUnitStarted()
public void beginUnit()
java.lang.IllegalStateException - if unit of work already startedpublic void endUnit()
java.lang.IllegalStateException - when no opened unit of work