001package io.ebean.annotation; 002 003/** 004 * Used to define the transactional scope for executing a method. Matches the 005 * types defined in the EJB TransactionAttributeType. 006 * <p> 007 * Used with the Transactional annotation and TxScope with 008 * <ul> 009 * <li>Ebean execute(TxScope, Runnable)</li> 010 * <li>Ebean executeCall(TxScope, Callable)</li> 011 * </ul> 012 * </p> 013 */ 014public enum TxType { 015 016 /** 017 * Uses an existing transaction and if none exists will starts a new 018 * Transaction. This is the default. 019 */ 020 REQUIRED, 021 022 /** 023 * A transaction MUST already have been started. Throws 024 * TransactionRequiredException. 025 */ 026 MANDATORY, 027 028 /** 029 * Uses the existing transaction if one exists, otherwise the method does not 030 * run with a transaction. Used this with caution. 031 */ 032 SUPPORTS, 033 034 /** 035 * Always start a new transaction. Suspend an existing once if required. 036 */ 037 REQUIRES_NEW, 038 039 /** 040 * Suspends an existing transaction if required. Method runs without a 041 * transaction. 042 */ 043 NOT_SUPPORTED, 044 045 /** 046 * If there is an existing transaction throws an Exception. Method runs 047 * without a transaction. 048 */ 049 NEVER 050}