Search in sources :

Example 1 with TransactionRequiredException

use of javax.transaction.TransactionRequiredException in project Payara by payara.

the class TransactionalInterceptorMandatory method transactional.

@AroundInvoke
public Object transactional(InvocationContext ctx) throws Exception {
    _logger.log(FINE, CDI_JTA_MANDATORY);
    if (isLifeCycleMethod(ctx)) {
        return proceed(ctx);
    }
    setTransactionalTransactionOperationsManger(false);
    try {
        if (getTransactionManager().getTransaction() == null) {
            throw new TransactionalException("TransactionRequiredException thrown from TxType.MANDATORY transactional interceptor.", new TransactionRequiredException("Managed bean with Transactional annotation and TxType of " + "MANDATORY called outside of a transaction context"));
        }
        return proceed(ctx);
    } finally {
        resetTransactionOperationsManager();
    }
}
Also used : TransactionRequiredException(javax.transaction.TransactionRequiredException) TransactionalException(javax.transaction.TransactionalException) AroundInvoke(javax.interceptor.AroundInvoke)

Aggregations

AroundInvoke (javax.interceptor.AroundInvoke)1 TransactionRequiredException (javax.transaction.TransactionRequiredException)1 TransactionalException (javax.transaction.TransactionalException)1