@Inherited
@InterceptorBinding
@Target(value={TYPE,METHOD})
@Retention(value=RUNTIME)
public @interface Transactional
Annotation used by applications to control transaction boundaries on CDI
managed beans, as well as classes defined as managed beans by the Java EE
specification such as servlets, JAX-RS resource classes, and JAX-WS
service endpoints, declaratively. This provides the semantics of EJB
transaction attributes in CDI without dependencies such as RMI. This
support is implemented via an implementation of a CDI interceptor that
conducts the necessary suspending, resuming, etc. The TxType element of
the annotation provides the semantic equivalent of the transaction
attributes in EJB.
By default checked exceptions do not result in the transactional
interceptor marking the transaction for rollback and instances of
RuntimeException and its subclasses do. This default behavior can be
overridden by specifying which exceptions result in the interceptor marking
the transaction for rollback. The rollbackOn element can be set to indicate
which exceptions should cause the interceptor to mark the transaction for
rollback. Conversely, the dontRollbackOn element can be set to indicate
which exceptions should not cause the interceptor to mark the transaction
for rollback. When a class is specified for either of these elements, the
designated behavior applies to subclasses of that class as well. If both
elements are specified, dontRollbackOn takes precedence.
EJB application exceptions (i.e., runtime exceptions annotated with
- Since:
- JTA1.2