Annotation Interface TransactionScoped
The javax.transaction.TransactionScoped annotation provides the ability to specify a standard CDI scope to define bean instances whose lifecycle is scoped to the currently active JTA transaction. This annotation has no effect on classes which have non-contextual references such those defined as managed beans by the Java EE specification.
The transaction scope is active when the return from a call toUserTransaction.getStatus
or
TransactionManager.getStatus
is one of the following states:
It is not intended that the term "active" as defined here in relation to the
TransactionScoped annotation should also apply to its use in relation to
transaction context, lifecycle, etc. mentioned elsewhere in this
specification. The object with this annotation will be associated with the
current active JTA transaction when the object is used. This association must
be retained through any transaction suspend or resume calls as well as any
Synchronization.beforeCompletion
callbacks. Any
Synchronization.afterCompletion
methods will be invoked in an undefined
context. The way in which the JTA transaction is begun and completed
(for example via UserTransaction, Transactional interceptor, etc.) is of no consequence.
The contextual references used across different JTA transactions are distinct.
Refer to the CDI specification for more details on contextual references.
A javax.enterprise.context.ContextNotActiveException
will be thrown if an object with this annotation is used when the
transaction context is not active.
- Since:
- JTA1.2