|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.transaction.support.DefaultTransactionDefinition org.springframework.transaction.interceptor.DefaultTransactionAttribute org.springframework.transaction.interceptor.RuleBasedTransactionAttribute
public class RuleBasedTransactionAttribute
TransactionAttribute implementation that works out whether a given exception should cause transaction rollback by applying a number of rollback rules, both positive and negative. If no rules are relevant to the exception, it behaves like DefaultTransactionAttribute (rolling back on runtime exceptions).
The TransactionAttributeEditor property editor creates objects of this class.
Field Summary | |
---|---|
protected static org.apache.commons.logging.Log |
logger
Static for optimal serializability |
Fields inherited from class org.springframework.transaction.interceptor.DefaultTransactionAttribute |
---|
COMMIT_RULE_PREFIX, ROLLBACK_RULE_PREFIX |
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 | |
---|---|
RuleBasedTransactionAttribute()
Create a new RuleBasedTransactionAttribute, with default settings. |
|
RuleBasedTransactionAttribute(int propagationBehavior,
List rollbackRules)
Create a new DefaultTransactionAttribute with the the given propagation behavior. |
|
RuleBasedTransactionAttribute(RuleBasedTransactionAttribute other)
Copy constructor. |
Method Summary | |
---|---|
List |
getRollbackRules()
Return the list of RollbackRuleAttribute objects. |
boolean |
rollbackOn(Throwable ex)
Winning rule is the shallowest rule (that is, the closest in the inheritance hierarchy to the exception). |
void |
setRollbackRules(List rollbackRules)
Set the list of RollbackRuleAttribute objects
(and/or NoRollbackRuleAttribute objects) to apply. |
String |
toString()
Return a description of 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 |
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 |
Field Detail |
---|
protected static final org.apache.commons.logging.Log logger
Constructor Detail |
---|
public RuleBasedTransactionAttribute()
DefaultTransactionDefinition.setPropagationBehavior(int)
,
DefaultTransactionDefinition.setIsolationLevel(int)
,
DefaultTransactionDefinition.setTimeout(int)
,
DefaultTransactionDefinition.setReadOnly(boolean)
,
DefaultTransactionDefinition.setName(java.lang.String)
,
setRollbackRules(java.util.List)
public RuleBasedTransactionAttribute(RuleBasedTransactionAttribute other)
DefaultTransactionDefinition.setPropagationBehavior(int)
,
DefaultTransactionDefinition.setIsolationLevel(int)
,
DefaultTransactionDefinition.setTimeout(int)
,
DefaultTransactionDefinition.setReadOnly(boolean)
,
DefaultTransactionDefinition.setName(java.lang.String)
,
setRollbackRules(java.util.List)
public RuleBasedTransactionAttribute(int propagationBehavior, List rollbackRules)
propagationBehavior
- one of the propagation constants in the
TransactionDefinition interfacerollbackRules
- the list of RollbackRuleAttributes to applyDefaultTransactionDefinition.setIsolationLevel(int)
,
DefaultTransactionDefinition.setTimeout(int)
,
DefaultTransactionDefinition.setReadOnly(boolean)
Method Detail |
---|
public void setRollbackRules(List rollbackRules)
RollbackRuleAttribute
objects
(and/or NoRollbackRuleAttribute
objects) to apply.
RollbackRuleAttribute
,
NoRollbackRuleAttribute
public List getRollbackRules()
RollbackRuleAttribute
objects.
public boolean rollbackOn(Throwable ex)
rollbackOn
in interface TransactionAttribute
rollbackOn
in class DefaultTransactionAttribute
ex
- the exception to evaluate
TransactionAttribute.rollbackOn(java.lang.Throwable)
public String toString()
DefaultTransactionAttribute
toString
in class DefaultTransactionAttribute
TransactionAttributeEditor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |