org.springframework.transaction.interceptor
Class DefaultTransactionAttribute

java.lang.Object
  extended by org.springframework.transaction.support.DefaultTransactionDefinition
      extended by org.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.03.2003
Author:
Rod Johnson
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.springframework.transaction.support.DefaultTransactionDefinition
PREFIX_ISOLATION, PREFIX_PROPAGATION, PREFIX_TIMEOUT, READ_ONLY_MARKER
 
Fields inherited from interface org.springframework.transaction.TransactionDefinition
ISOLATION_DEFAULT, ISOLATION_READ_COMMITTED, ISOLATION_READ_UNCOMMITTED, ISOLATION_REPEATABLE_READ, ISOLATION_SERIALIZABLE, PROPAGATION_MANDATORY, PROPAGATION_NESTED, PROPAGATION_NEVER, PROPAGATION_NOT_SUPPORTED, PROPAGATION_REQUIRED, PROPAGATION_REQUIRES_NEW, PROPAGATION_SUPPORTS, TIMEOUT_DEFAULT
 
Constructor Summary
DefaultTransactionAttribute()
          Create a new DefaultTransactionAttribute, with default settings.
DefaultTransactionAttribute(int propagationBehavior)
          Create a new DefaultTransactionAttribute with the the given propagation behavior.
DefaultTransactionAttribute(TransactionAttribute other)
          Copy constructor.
 
Method Summary
protected  StringBuilder getAttributeDescription()
          Return an identifying description for this transaction attribute.
 String getQualifier()
          Return a qualifier value associated with this transaction attribute.
 boolean rollbackOn(Throwable ex)
          The default behavior is as with EJB: rollback on unchecked exception.
 void setQualifier(String qualifier)
          Associate a qualifier value with this transaction attribute.
 
Methods inherited from class org.springframework.transaction.support.DefaultTransactionDefinition
equals, getDefinitionDescription, getIsolationLevel, getName, getPropagationBehavior, getTimeout, hashCode, isReadOnly, setIsolationLevel, setIsolationLevelName, setName, setPropagationBehavior, setPropagationBehaviorName, setReadOnly, setTimeout, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.transaction.TransactionDefinition
getIsolationLevel, getName, getPropagationBehavior, getTimeout, isReadOnly
 

Constructor Detail

DefaultTransactionAttribute

public DefaultTransactionAttribute()
Create a new DefaultTransactionAttribute, with default settings. Can be modified through bean property setters.

See Also:
DefaultTransactionDefinition.setPropagationBehavior(int), DefaultTransactionDefinition.setIsolationLevel(int), DefaultTransactionDefinition.setTimeout(int), DefaultTransactionDefinition.setReadOnly(boolean), DefaultTransactionDefinition.setName(java.lang.String)

DefaultTransactionAttribute

public DefaultTransactionAttribute(TransactionAttribute other)
Copy constructor. Definition can be modified through bean property setters.

See Also:
DefaultTransactionDefinition.setPropagationBehavior(int), DefaultTransactionDefinition.setIsolationLevel(int), DefaultTransactionDefinition.setTimeout(int), DefaultTransactionDefinition.setReadOnly(boolean), DefaultTransactionDefinition.setName(java.lang.String)

DefaultTransactionAttribute

public DefaultTransactionAttribute(int propagationBehavior)
Create a new DefaultTransactionAttribute with the the given propagation behavior. Can be modified through bean property setters.

Parameters:
propagationBehavior - one of the propagation constants in the TransactionDefinition interface
See Also:
DefaultTransactionDefinition.setIsolationLevel(int), DefaultTransactionDefinition.setTimeout(int), DefaultTransactionDefinition.setReadOnly(boolean)
Method Detail

setQualifier

public void setQualifier(String qualifier)
Associate a qualifier value with this transaction attribute.

This may be used for choosing a corresponding transaction manager to process this specific transaction.


getQualifier

public String getQualifier()
Return a qualifier value associated with this transaction attribute.

Specified by:
getQualifier in interface TransactionAttribute

rollbackOn

public boolean rollbackOn(Throwable ex)
The default behavior is as with EJB: rollback on unchecked exception. Additionally attempt to rollback on Error.

This is consistent with TransactionTemplate's default behavior.

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

getAttributeDescription

protected final StringBuilder getAttributeDescription()
Return an identifying description for this transaction attribute.

Available to subclasses, for inclusion in their toString() result.