21.5. Annotations for transaction demarcation

21.5. Annotations for transaction demarcation

Seam provides an annotation that lets you force a rollback of the JTA transaction for certain action listener outcomes.

@Rollback
@Rollback(ifOutcome={"failure", "not-found"})

If the outcome of the method matches any of the listed outcomes, or if no outcomes are listed, set the transaction to rollback only when the method completes.

  • ifOutcome — the JSF outcomes that cause a transaction rollback (no outcomes is interpreted to mean any outcome).

@Transactional
@Transactional

Specifies that a JavaBean component should have a similar transactional behavior to the default behavior of a session bean component. ie. method invocations should take place in a transaction, and if no transaction exists when the method is called, a transaction will be started just for that method. This annotation may be applied at either class or method level.

Seam applications usually use the standard EJB3 annotations for all other transaction demarcation needs.