com.avaje.ebean
Enum TxType

java.lang.Object
  extended by java.lang.Enum<TxType>
      extended by com.avaje.ebean.TxType
All Implemented Interfaces:
Serializable, Comparable<TxType>

public enum TxType
extends Enum<TxType>

    

Used to define the transactional scope for executing a method. Matches the types defined in the EJB TransactionAttributeType.

Used with the Transactional annotation and the TxScope with Ebean.execute(TxScope, TxCallable) and Ebean.execute(TxScope, TxRunnable).

See Also:
TxScope

Enum Constant Summary
MANDATORY
          A transaction MUST already have been started.
NEVER
          If there is an existing transaction throws an Exception.
NOT_SUPPORTED
          Suspends an existing transaction if required.
REQUIRED
          Uses an existing transaction and if none exists will starts a new Transaction.
REQUIRES_NEW
          Always start a new transaction.
SUPPORTS
          Uses the existing transaction if one exists, otherwise the method does not run with a transaction.
 
Method Summary
static TxType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static TxType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

REQUIRED

public static final TxType REQUIRED
Uses an existing transaction and if none exists will starts a new Transaction. This is the default.


MANDATORY

public static final TxType MANDATORY
A transaction MUST already have been started. Throws TransactionRequiredException.


SUPPORTS

public static final TxType SUPPORTS
Uses the existing transaction if one exists, otherwise the method does not run with a transaction. Used this with caution.


REQUIRES_NEW

public static final TxType REQUIRES_NEW
Always start a new transaction. Suspend an existing once if required.


NOT_SUPPORTED

public static final TxType NOT_SUPPORTED
Suspends an existing transaction if required. Method runs without a transaction.


NEVER

public static final TxType NEVER
If there is an existing transaction throws an Exception. Method runs without a transaction.

Method Detail

values

public static TxType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (TxType c : TxType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static TxType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null


Copyright © 2010. All Rights Reserved.