public interface TransactionHandler
Jdbi instance. All Handle instances
opened from that Jdbi will use the handler specified.
The default implementation, ConnectionTransactionHandler, explicitly manages
the transactions on the underlying JDBC Connection.
| Modifier and Type | Method and Description |
|---|---|
void |
begin(Handle handle)
Begin a transaction.
|
void |
commit(Handle handle)
Commit the transaction.
|
<R,X extends Exception> |
inTransaction(Handle handle,
HandleCallback<R,X> callback)
Run a transaction.
|
<R,X extends Exception> |
inTransaction(Handle handle,
TransactionIsolationLevel level,
HandleCallback<R,X> callback)
Run a transaction.
|
boolean |
isInTransaction(Handle handle) |
void |
releaseSavepoint(Handle handle,
String savepointName)
Release a previously created savepoint.
|
void |
rollback(Handle handle)
Roll back the transaction.
|
void |
rollbackToSavepoint(Handle handle,
String savepointName)
Roll back to a named savepoint.
|
void |
savepoint(Handle handle,
String savepointName)
Create a new savepoint.
|
void begin(Handle handle)
handle - the handle the transaction is being started onvoid commit(Handle handle)
handle - the handle the commit is being performed on<R,X extends Exception> R inTransaction(Handle handle, HandleCallback<R,X> callback) throws X extends Exception
R - the callback return typeX - the exception type thrown by the callback, if anyhandle - the handle to the databasecallback - a callback which will receive the open handle, in a transaction.X - any exception thrown by the callback.X extends ExceptionHandle.inTransaction(HandleCallback)<R,X extends Exception> R inTransaction(Handle handle, TransactionIsolationLevel level, HandleCallback<R,X> callback) throws X extends Exception
R - the callback return typeX - the exception type thrown by the callback, if anyhandle - the handle to the databaselevel - the isolation level for the transactioncallback - a callback which will receive the open handle, in a transaction.X - any exception thrown by the callback.X extends ExceptionHandle.inTransaction(TransactionIsolationLevel, HandleCallback)boolean isInTransaction(Handle handle)
handle - the handle to testvoid releaseSavepoint(Handle handle, String savepointName)
handle - the handle on which the savepoint is being releasedsavepointName - the savepoint to releasevoid rollback(Handle handle)
handle - the handle the rollback is being performed onvoid rollbackToSavepoint(Handle handle, String savepointName)
handle - the handle the rollback is being performed onsavepointName - the name of the savepoint to rollback toCopyright © 2017. All rights reserved.