org.springframework.transaction.interceptor
Class DefaultTransactionAttribute

java.lang.Object
  extended byorg.springframework.transaction.support.DefaultTransactionDefinition
      extended byorg.springframework.transaction.interceptor.DefaultTransactionAttribute
All Implemented Interfaces:
Serializable, TransactionAttribute, TransactionDefinition
Direct Known Subclasses:
RuleBasedTransactionAttribute

public class DefaultTransactionAttribute
extends DefaultTransactionDefinition
implements TransactionAttribute

Transaction attribute that takes the EJB approach to rolling back on runtime, but not checked, exceptions.

Since:
16-Mar-2003
Author:
Rod Johnson
See Also:
Serialized Form

Field Summary
static String COMMIT_RULE_PREFIX
          Prefix for commit-on-exception rules in description strings
static String ROLLBACK_RULE_PREFIX
          Prefix for rollback-on-exception rules in description strings
 
Fields inherited from class org.springframework.transaction.support.DefaultTransactionDefinition
READ_ONLY_MARKER, TIMEOUT_PREFIX
 
Fields inherited from interface org.springframework.transaction.TransactionDefinition
ISOLATION_CONSTANT_PREFIX, ISOLATION_DEFAULT, ISOLATION_READ_COMMITTED, ISOLATION_READ_UNCOMMITTED, ISOLATION_REPEATABLE_READ, ISOLATION_SERIALIZABLE, PROPAGATION_CONSTANT_PREFIX, PROPAGATION_MANDATORY, PROPAGATION_NESTED, PROPAGATION_NEVER, PROPAGATION_NOT_SUPPORTED, PROPAGATION_REQUIRED, PROPAGATION_REQUIRES_NEW, PROPAGATION_SUPPORTS, TIMEOUT_DEFAULT
 
Constructor Summary
DefaultTransactionAttribute()
           
DefaultTransactionAttribute(int propagationBehavior)
           
 
Method Summary
 boolean rollbackOn(Throwable ex)
          Default behavior is as with EJB: rollback on unchecked exception.
 String toString()
          Return a description of this transaction attribute.
 
Methods inherited from class org.springframework.transaction.support.DefaultTransactionDefinition
equals, getDefinitionDescription, getIsolationLevel, getPropagationBehavior, getTimeout, hashCode, isReadOnly, setIsolationLevel, setIsolationLevelName, setPropagationBehavior, setPropagationBehaviorName, setReadOnly, setTimeout
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.transaction.TransactionDefinition
getIsolationLevel, getPropagationBehavior, getTimeout, isReadOnly
 

Field Detail

ROLLBACK_RULE_PREFIX

public static final String ROLLBACK_RULE_PREFIX
Prefix for rollback-on-exception rules in description strings

See Also:
Constant Field Values

COMMIT_RULE_PREFIX

public static final String COMMIT_RULE_PREFIX
Prefix for commit-on-exception rules in description strings

See Also:
Constant Field Values
Constructor Detail

DefaultTransactionAttribute

public DefaultTransactionAttribute()

DefaultTransactionAttribute

public DefaultTransactionAttribute(int propagationBehavior)
Method Detail

rollbackOn

public boolean rollbackOn(Throwable ex)
Default behavior is as with EJB: rollback on unchecked exception. Additionally attempt to rollback on Error. Consistent with TransactionTemplate's behavior.

Specified by:
rollbackOn in interface TransactionAttribute
Parameters:
ex - the exception to evaluate
Returns:
boolean rollback or not

toString

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

Overrides:
toString in class DefaultTransactionDefinition
See Also:
TransactionAttributeEditor


Copyright (C) 2003-2004 The Spring Framework Project.