mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1935 - ENH: Add DB.createTransaction()
This commit is contained in:
@@ -176,6 +176,18 @@ public class DB {
|
||||
return getDefault().beginTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new transaction that is not held in TransactionThreadLocal.
|
||||
* <p>
|
||||
* You will want to do this if you want multiple Transactions in a single
|
||||
* thread or generally use transactions outside of the TransactionThreadLocal
|
||||
* management.
|
||||
* </p>
|
||||
*/
|
||||
public static Transaction createTransaction() {
|
||||
return getDefault().createTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a transaction additionally specifying the isolation level.
|
||||
*
|
||||
|
||||
@@ -41,7 +41,7 @@ public class TestQueryUsingConnection extends BaseTestCase {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
try (Transaction transaction = DB.getDefault().createTransaction()) {
|
||||
try (Transaction transaction = DB.createTransaction()) {
|
||||
|
||||
Transaction current = Transaction.current();
|
||||
assertThat(current).isNull();
|
||||
|
||||
Reference in New Issue
Block a user