Save This Page
Home » Spring-Framework-090522 » org.springframework » transaction » annotation » [javadoc | source]
org.springframework.transaction.annotation
public class: Transactional [javadoc | source]
org.springframework.transaction.annotation.Transactional
Describes transaction attributes on a method or class.

This annotation type is generally directly comparable to Spring's org.springframework.transaction.interceptor.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 org.springframework.transaction.interceptor.DefaultTransactionAttribute (rolling back on runtime exceptions).

Method from org.springframework.transaction.annotation.Transactional Summary:
isolation,   noRollbackFor,   noRollbackForClassName,   propagation,   readOnly,   rollbackFor,   rollbackForClassName,   timeout,   value
Method from org.springframework.transaction.annotation.Transactional Detail:
 Isolation isolation() 
 Class<Throwable>[] noRollbackFor() 
 String[] noRollbackForClassName() 
 Propagation propagation() 
 boolean readOnly() 
    true if the transaction is read-only.

    Defaults to false.

 Class<Throwable>[] rollbackFor() 
 String[] rollbackForClassName() 
    Defines zero (0) or more exception names (for exceptions which must be a subclass of Throwable ), indicating which exception types must cause a transaction rollback.

    This can be a substring, with no wildcard support at present. A value of "ServletException" would match javax.servlet.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 is no need to use a FQN.

    Similar to org.springframework.transaction.interceptor.RollbackRuleAttribute#RollbackRuleAttribute(String exceptionName)

 int timeout() 
    The timeout for this transaction.

    Defaults to the default timeout of the underlying transaction system.

 String value()