mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-25 07:57:39 +00:00
#303 - Change beginTransaction() to use REQUIRED scope by default
This commit is contained in:
@@ -315,7 +315,10 @@ public final class Ebean {
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a new explicit transaction.
|
||||
* Start a transaction with 'REQUIRED' semantics.
|
||||
* <p>
|
||||
* With REQUIRED semantics if an active transaction already exists that transaction will be used.
|
||||
* </p>
|
||||
* <p>
|
||||
* The transaction is stored in a ThreadLocal variable and typically you only
|
||||
* need to use the returned Transaction <em>IF</em> you wish to do things like
|
||||
|
||||
@@ -509,7 +509,10 @@ public interface EbeanServer {
|
||||
Transaction createTransaction(TxIsolation isolation);
|
||||
|
||||
/**
|
||||
* Start a new explicit transaction putting it into a ThreadLocal.
|
||||
* Start a transaction with 'REQUIRED' semantics.
|
||||
* <p>
|
||||
* With REQUIRED semantics if an active transaction already exists that transaction will be used.
|
||||
* </p>
|
||||
* <p>
|
||||
* The transaction is stored in a ThreadLocal variable and typically you only
|
||||
* need to use the returned Transaction <em>IF</em> you wish to do things like
|
||||
|
||||
@@ -756,16 +756,16 @@ public final class DefaultServer implements SpiEbeanServer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a transaction.
|
||||
* Start a transaction with 'REQUIRED' semantics.
|
||||
* <p>
|
||||
* If a transaction already exists that transaction will be used.
|
||||
* </p>
|
||||
* <p>
|
||||
* Note that the transaction is stored in a ThreadLocal variable.
|
||||
* </p>
|
||||
*/
|
||||
public Transaction beginTransaction() {
|
||||
// start an explicit transaction
|
||||
SpiTransaction t = transactionManager.createTransaction(true, -1);
|
||||
transactionScopeManager.set(t);
|
||||
return t;
|
||||
return beginTransaction(TxScope.required());
|
||||
}
|
||||
|
||||
public Transaction beginTransaction(TxScope scope) {
|
||||
|
||||
Reference in New Issue
Block a user