Package javax.transaction

Examples of javax.transaction.UserTransaction.begin()


     * @throws Exception if an error during the tests occurs.
     */
    public void testUsingClientTransWithRuntimeException(final Class expectedException, final boolean canCommit)
            throws Exception {
        UserTransaction utx = ExceptionHandleUtil.getUserTransaction();
        utx.begin();
        // verifies if the exception thrown is correct
        try {
            sfsbContainerTransactionRuntime.insertCorrectFirstErrorSecond(DATABASE_1, DATABASE_2);
        } catch (Exception e) {
            assertTrue(ExceptionHelper.isEquals(e, expectedException),
View Full Code Here


     * @throws Exception if an error occurs.
     */
    public void getUserTransactionWithLookup() throws Exception {
        try {
            UserTransaction utx = TransactionHelper.getUserTransaction();
            utx.begin();
            utx.commit();
        } catch (Exception e) {
            throw new TransactionException("The bean cannot get the user transaction with the JNDI", e);
        }
    }
View Full Code Here

     * @throws Exception if an error occurs.
     */
    public void getUserTransactionWithEJBContext() throws Exception {
        try {
            UserTransaction utx = ctx.getUserTransaction();
            utx.begin();
            utx.commit();
        } catch (Exception e) {
            throw new TransactionException("The bean cannot get the user transaction with the EJBContext", e);
        }
    }
View Full Code Here

     * @throws Exception if an error occurs during the tests.
     */
    @Test
    public void testSessionSyncWithMandatory() throws Exception {
        UserTransaction utx = getUserTransaction();
        utx.begin();
        sfsbSessionSync.insertTableMandatory();
        try{
            utx.commit();
        }catch(Exception e){
           logger.debug("The method threw an expected exception {e}", e);
View Full Code Here

     * @throws Exception if an error occurs during the tests.
     */
    @Test
    public void testSessionSyncWithUserTransAndSupports() throws Exception {
        UserTransaction utx = getUserTransaction();
        utx.begin();
        sfsbSessionSync.insertTableSupports();
        try{
            utx.commit();
        }catch(Exception e){
           logger.debug("The method threw an expected exception {e}", e);
View Full Code Here

    public void testAppExceptionWithoutRollback() throws Exception{
        //verifies if the application exception is re-throw
        //the exception is not a checked exception
        UserTransaction utx = TransactionHelper.getInternalUserTransaction();
        try{
            utx.begin();
            bean.createTableWithAppException(DB_NAME);
            fail("The container did not re-throw the application exception.");
        }catch(CustomException01 e){
           logger.debug("The container threw an expected exception {0}", e);
        }finally{
View Full Code Here

    public void testAppExceptionWithRollbackOverride() throws Exception{
        //verifies if the application exception is re-throw
        //the exception is not a checked exception
        UserTransaction utx = TransactionHelper.getInternalUserTransaction();
        try{
            utx.begin();
            bean.createTableWithAppExceptionOverride(DB_NAME);
            fail("The container did not re-throw the application exception.");
        }catch(RollbackApplicationException e){
           logger.debug("The container threw an expected exception {0}", e);
        }finally{
View Full Code Here

    public void testAppExceptionWithRollback() throws Exception{
        //verifies if the application exception is re-throw
        //the exception is a checked exception
        UserTransaction utx = TransactionHelper.getInternalUserTransaction();
        try{
            utx.begin();
            bean.createTableWithAppExceptionAndRollback(DB_NAME);
            fail("The container did not re-throw the application exception.");
        }catch(CustomException00 e){
           logger.debug("The container threw an expected exception {0}", e);
        }finally{
View Full Code Here

    public void testAppExceptionWithRollbackDefault() throws Exception{
        //verifies if the application exception is re-throw
        //the exception is not a checked exception
        UserTransaction utx = TransactionHelper.getInternalUserTransaction();
        try{
            utx.begin();
            bean.createTableWithAppExceptionDefault(DB_NAME);
            fail("The container did not re-throw the application exception.");
        }catch(IllegalException e){
           logger.debug("The container threw an expected exception {0}", e);
        }finally{
View Full Code Here

        // the transaction attribute defined for all methods is required, so the
        // method must work with or without a client transaction.

        // the method is working with transaction...
        UserTransaction utx = TransactionHelper.getInternalUserTransaction();
        utx.begin();
        bean.insertTable01(DB_NAME, TABLE_NAME);
        utx.commit();

        // cleans the db to avoid error
        deleteTable(DB_NAME, TABLE_NAME);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.