mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
40 lines
764 B
Java
40 lines
764 B
Java
package com.avaje.ebean;
|
|
|
|
/**
|
|
* Execute a TxRunnable in a Transaction scope.
|
|
* <p>
|
|
* Use this with the {@link Ebean#execute(TxRunnable)} method.
|
|
* </p>
|
|
* <p>
|
|
* See also {@link TxCallable}.
|
|
* </p>
|
|
*
|
|
* <pre class="code">
|
|
*
|
|
* // this run method runs in a transaction scope
|
|
* // which by default is TxScope.REQUIRED
|
|
*
|
|
* Ebean.execute(new TxRunnable() {
|
|
* public void run() {
|
|
* User u1 = Ebean.find(User.class, 1);
|
|
* User u2 = Ebean.find(User.class, 2);
|
|
*
|
|
* u1.setName("u1 mod");
|
|
* u2.setName("u2 mod");
|
|
*
|
|
* Ebean.save(u1);
|
|
* Ebean.save(u2);
|
|
* }
|
|
* });
|
|
* </pre>
|
|
*
|
|
* @see TxCallable
|
|
*/
|
|
public interface TxRunnable {
|
|
|
|
/**
|
|
* Run the method in a transaction sope.
|
|
*/
|
|
void run();
|
|
}
|