001package com.avaje.ebean; 002 003/** 004 * Execute a TxRunnable in a Transaction scope. 005 * <p> 006 * Use this with the {@link Ebean#execute(TxRunnable)} method. 007 * </p> 008 * <p> 009 * See also {@link TxCallable}. 010 * </p> 011 * 012 * <pre class="code"> 013 * 014 * // this run method runs in a transaction scope 015 * // which by default is TxScope.REQUIRED 016 * 017 * Ebean.execute(new TxRunnable() { 018 * public void run() { 019 * User u1 = Ebean.find(User.class, 1); 020 * User u2 = Ebean.find(User.class, 2); 021 * 022 * u1.setName("u1 mod"); 023 * u2.setName("u2 mod"); 024 * 025 * Ebean.save(u1); 026 * Ebean.save(u2); 027 * } 028 * }); 029 * </pre> 030 * 031 * @see TxCallable 032 */ 033public interface TxRunnable { 034 035 /** 036 * Run the method in a transaction sope. 037 */ 038 void run(); 039}