Package javax.transaction

Examples of javax.transaction.TransactionalException


            String messageString =
                    "Managed bean with Transactional annotation and TxType of REQUIRES_NEW " +
                            "encountered exception during begin " +
                            exception;
            _logger.info(messageString);
            throw new TransactionalException(messageString, exception);
        }
        Object proceed = null;
        try {
            proceed = proceed(ctx);
        } finally {
            try {
                getTransactionManager().commit();
            } catch (Exception exception) {
                String messageString =
                        "Managed bean with Transactional annotation and TxType of REQUIRES_NEW " +
                                "encountered exception during commit " +
                                exception;
                _logger.info(messageString);
                throw new TransactionalException(messageString, exception);
            }
            if (suspendedTransaction != null) {
                try {
                    getTransactionManager().resume(suspendedTransaction);
                } catch (Exception exception) {
                    String messageString =
                            "Managed bean with Transactional annotation and TxType of REQUIRED " +
                                    "encountered exception during resume " +
                                    exception;
                    _logger.info(messageString);
                    throw new TransactionalException(messageString, exception);
                }
            }
        }
        return proceed;
    }
View Full Code Here


    @AroundInvoke
    public Object transactional(InvocationContext ctx) throws Exception {
        _logger.info("In NEVER TransactionalInterceptor");
        if(getTransactionManager().getTransaction() != null)
            throw new TransactionalException(
                    "InvalidTransactionException thrown from TxType.NEVER transactional interceptor.",
                    new InvalidTransactionException("Managed bean with Transactional annotation and TxType of NEVER " +
                    "called inside a transaction context"));
        return proceed(ctx);
    }
View Full Code Here

    @AroundInvoke
    public Object transactional(InvocationContext ctx) throws Exception {
        _logger.info("In MANDATORY TransactionalInterceptor");
        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);
    }
View Full Code Here

TOP

Related Classes of javax.transaction.TransactionalException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.