org.springframework.transaction.support
Class DefaultTransactionDefinition

Direct Known Subclasses:
DefaultTransactionAttribute, TransactionTemplate

public class DefaultTransactionDefinition
implements TransactionDefinition

Default implementation of the TransactionDefinition interface, offering bean-style configuration and sensible default values (PROPAGATION_REQUIRED, ISOLATION_DEFAULT, TIMEOUT_DEFAULT, readOnly=false).

Base class for both TransactionTemplate and DefaultTransactionAttribute.

Author:
Juergen Hoeller
Since: 08.05.2003
See Also: TransactionTemplate, DefaultTransactionAttribute

Field Summary
 final static StringREAD_ONLY_MARKER
          Marker for read-only transactions in description strings
 final static StringTIMEOUT_PREFIX
          Prefix for transaction timeout values in description strings

Constructor Summary
DefaultTransactionDefinition()
           
DefaultTransactionDefinition(int propagationBehavior)
           

Method Summary
 booleanequals(Object other)
          This implementation of equals compares the toString results.
 final intgetIsolationLevel()
           
 final intgetPropagationBehavior()
           
 final intgetTimeout()
           
 inthashCode()
          This implementation of hashCode returns toString's hash code.
 final booleanisReadOnly()
           
 final voidsetIsolationLevel(int isolationLevel)
           
 final voidsetIsolationLevelName(String constantName)
          Set the isolation level by the name of the corresponding constant in TransactionDefinition, e.g.
 final voidsetPropagationBehavior(int propagationBehavior)
           
 final voidsetPropagationBehaviorName(String constantName)
          Set the propagation behavior by the name of the corresponding constant in TransactionDefinition, e.g.
 final voidsetReadOnly(boolean readOnly)
           
 final voidsetTimeout(int timeout)
           
 StringtoString()
          Return an identifying description of this transaction definition.

Field Detail

READ_ONLY_MARKER

public final static String READ_ONLY_MARKER
Marker for read-only transactions in description strings

TIMEOUT_PREFIX

public final static String TIMEOUT_PREFIX
Prefix for transaction timeout values in description strings
Constructor Detail

DefaultTransactionDefinition

public DefaultTransactionDefinition()

DefaultTransactionDefinition

public DefaultTransactionDefinition(int propagationBehavior)
Method Detail

equals

public boolean equals(Object other)
This implementation of equals compares the toString results.
See Also:
toString()

getIsolationLevel

public final int getIsolationLevel()

getPropagationBehavior

public final int getPropagationBehavior()

getTimeout

public final int getTimeout()

hashCode

public int hashCode()
This implementation of hashCode returns toString's hash code.
See Also:
toString()

isReadOnly

public final boolean isReadOnly()

setIsolationLevel

public final void setIsolationLevel(int isolationLevel)

setIsolationLevelName

public final void setIsolationLevelName(String constantName)
throws java.lang.IllegalArgumentException
Set the isolation level by the name of the corresponding constant in TransactionDefinition, e.g. "ISOLATION_DEFAULT".
Parameters:
constantName - name of the constant
Throws:
java.lang.IllegalArgumentException - if an invalid constant was specified
See Also:
org.springframework.transaction.TransactionDefinition.ISOLATION_DEFAULT

setPropagationBehavior

public final void setPropagationBehavior(int propagationBehavior)

setPropagationBehaviorName

public final void setPropagationBehaviorName(String constantName)
throws java.lang.IllegalArgumentException
Set the propagation behavior by the name of the corresponding constant in TransactionDefinition, e.g. "PROPAGATION_REQUIRED".
Parameters:
constantName - name of the constant
Throws:
java.lang.IllegalArgumentException - if an invalid constant was specified
See Also:
org.springframework.transaction.TransactionDefinition.PROPAGATION_REQUIRED

setReadOnly

public final void setReadOnly(boolean readOnly)

setTimeout

public final void setTimeout(int timeout)

toString

public String toString()
Return an identifying description of this transaction definition. The format matches the one used by TransactionAttributeEditor, to be able to feed toString results into TransactionAttribute properties.

Has to be overridden in subclasses for correct equals and hashCode behavior. Alternatively, equals and hashCode can be overridden themselves.

See Also:
TransactionAttributeEditor

Association Links

to Class java.lang.String

Prefix for transaction timeout values in description strings

to Class java.lang.String

Marker for read-only transactions in description strings

to Class org.springframework.core.Constants

Constants instance for TransactionDefinition