2.3.5.1. Transaction Annotations

@Stateful @TransactionManagement (BEAN) public class SomeBeanClass implements SomeBeanInterface {
    @Resource javax.Transaction.UserTransaction transaction;

    public void myMethodOne () {
        transaction.begin ();
        ...
    }

    public void myMethodTwo () {
        ...
        transaction.commit ();
    }
}

@Stateless public class SomeBeanClass implements SomeBeanInterface {
    @TransactionAttribute (REQUIRED) public void myMethod () {
        ...
    }
}
BEAN

bean demarcated transactions

NEVER

transaction must not be active or exception is thrown

MANDATORY

transaction must be active or exception is thrown

SUPPORTS

no specific demarcation performed by the container

NOT_SUPPORTED

active transaction suspended during call

REQUIRED

active transaction used or new transaction started during call

REQUIRES_NEW

active transaction suspended and new transaction started during call