|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Target(value={METHOD,TYPE}) @Retention(value=RUNTIME) @Inherited @Documented public @interface Transactional
JDK 1.5+ annotation for describing transaction attributes on a method or class.
This annotation type is generally directly comparable to Spring's
RuleBasedTransactionAttribute
class, and in fact AnnotationTransactionAttributeSource
will directly
convert the data to the latter class, so that Spring's transaction support code
does not have to know about Annotations. If no rules are relevant to the exception,
it will be treated like DefaultTransactionAttribute (rolling back on runtime
exceptions).
DefaultTransactionAttribute
,
RuleBasedTransactionAttribute
Optional Element Summary | |
---|---|
Isolation |
isolation
The transaction isolation level |
Class[] |
noRollbackFor
0 or more exception Classes, which must be a subclass of Throwable, indicating which exception types should not cause a transaction rollback. |
String[] |
noRollbackForClassName
0 or more exception names (for exceptions which must be a subclass of Throwable) which indicate exception types which should not cause a transaction rollback. |
Propagation |
propagation
The transaction propagation type |
boolean |
readOnly
True if the transaction is read-only |
Class[] |
rollbackFor
0 or more exception Classes, which must be a subclass of Throwable, indicating which exception types should cause a transaction rollback. |
String[] |
rollbackForClassName
0 or more exception names (for exceptions which must be a subclass of Throwable) which indicate exception types which should cause a transaction rollback. |
public abstract Propagation propagation
public abstract Isolation isolation
public abstract boolean readOnly
public abstract Class[] rollbackFor
Similar to RollbackRuleAttribute.RollbackRuleAttribute(Class clazz)
public abstract String[] rollbackForClassName
This can be a substring, with no wildcard support at present. A value of "ServletException" would match ServletException and subclasses, for example.
NB: Consider carefully how specific the pattern is, and whether to include package information (which isn't mandatory). For example, "Exception" will match nearly anything, and will probably hide other rules. "java.lang.Exception" would be correct if "Exception" was meant to define a rule for all checked exceptions. With more unusual Exception names such as "BaseBusinessException" there's no need to use a FQN.
Similar to RollbackRuleAttribute.RollbackRuleAttribute(String exceptionName)
public abstract Class[] noRollbackFor
Similar to NoRollbackRuleAttribute.NoRollbackRuleAttribute(Class clazz)
public abstract String[] noRollbackForClassName
See description of rollbackForClassName()
for more info on how
the specified names are treated.
Similar to NoRollbackRuleAttribute.NoRollbackRuleAttribute(String exceptionName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |