public final class DefaultTransactionThreadLocal extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
commit(String serverName)
Commit the current transaction.
|
static void |
end(String serverName)
If the transaction has not been committed then roll it back.
|
static SpiTransaction |
get(String serverName)
Return the current Transaction for this serverName and Thread.
|
static void |
replace(String serverName,
SpiTransaction trans)
A mechanism to get the transaction out of the thread local by replacing it
with a 'proxy'.
|
static void |
rollback(String serverName)
Rollback the current transaction.
|
static void |
set(String serverName,
SpiTransaction trans)
Set a new Transaction for this serverName and Thread.
|
public static void set(String serverName, SpiTransaction trans)
public static void replace(String serverName, SpiTransaction trans)
Used for background fetching. Replaces the current transaction with a 'dummy' transaction. The current transaction is given to the background thread so it can continue the fetch.
public static SpiTransaction get(String serverName)
public static void commit(String serverName)
public static void rollback(String serverName)
public static void end(String serverName)
Designed to be put in a finally block instead of a rollback() in each catch block.
Ebean.beingTransaction();
try {
// ... perform some actions in a single transaction
Ebean.commitTransaction();
} finally {
// ensure transaction ended. If some error occurred then rollback()
Ebean.endTransaction();
}
Copyright © 2014. All Rights Reserved.