Package javax.transaction

Examples of javax.transaction.UserTransaction.begin()


         Connection conn = mcf.createConnection();
         conn.start();

         UserTransaction ut = ServerManagement.getUserTransaction();

         ut.begin();

         Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageProducer p = s.createProducer(queue);
         Message m = s.createTextMessage("one");
View Full Code Here


     */
    @Test(expectedExceptions = javax.ejb.EJBException.class)
    public void testClassDefinition() throws Exception {
        UserTransaction utx = TransactionHelper.getInternalUserTransaction();
        try {
            utx.begin();
            slsbCMTInheritance.dummyMethod1();
        } finally {
            utx.rollback();
        }
    }
View Full Code Here

     */
    @Test
    public void testOverrideSuperclassDefinition2() throws Exception {
        UserTransaction utx = TransactionHelper.getInternalUserTransaction();
        try {
            utx.begin();
            slsbCMTInheritance.dummyMethod4();
        } finally {
            utx.rollback();
        }
    }
View Full Code Here

     * @throws NotSupportedException if the bean is already associated with a transaction.
     * @throws SystemException if an unexpected error occurs during the transaction.
     */
    public void openTransaction() throws NamingException, NotSupportedException, SystemException {
        UserTransaction utx = TransactionHelper.getUserTransaction();
        utx.begin();
    }

    /**
     * Verifies if the bean has a bean-managed transaction. If the transaction
     * type is defined as container managed transaction, this method must throw
View Full Code Here

     * @throws TransactionException if a rollback was made.
     */
    public void verifyBMT() throws IllegalStateException, SecurityException, HeuristicMixedException,
            HeuristicRollbackException, RollbackException, SystemException, NotSupportedException, NamingException {
        UserTransaction utx = TransactionHelper.getUserTransaction();
        utx.begin();
        utx.commit();
    }
}
View Full Code Here

            //EntityManager Access
            UserTransaction utx;
            try{
                utx = ctx.getUserTransaction();
                utx.begin();
            }catch(Exception e){
                utx = null;
            }

            checkInstance(eManager, EntityManagerTester.NAME);
View Full Code Here

     *        rollback(transaction attribute:Required, Mandatory and Supports).
     * @throws Exception if an error during the tests occurs.
     */
    public void testUsingClientTransWithAppRollbackException(final boolean canCommit) throws Exception {
        UserTransaction utx = ExceptionHandleUtil.getUserTransaction();
        utx.begin();
        try {
            sfsbContainerTransactionRollback.insertCorrectFirstErrorSecond(DATABASE_1, DATABASE_2);
            fail("The container did not re-throw the application exception.");
        } catch (RollbackApplicationException e) {
            logger.debug("The bean threw an expected error during the execution {0}", e);
View Full Code Here

     * this case.This test uses a client transaction.
     * @throws Exception if an error during the tests occurs.
     */
    public void testUsingClientTransWithAppException() throws Exception {
        UserTransaction utx = ExceptionHandleUtil.getUserTransaction();
        utx.begin();
        try {
            sfsbContainerTransactionApp.insertCorrectFirstErrorSecond(DATABASE_1, DATABASE_2);
            fail("The container did not re-throw the application exception.");
        } catch (AppException e) {
            logger.debug("The bean threw an expected error during the execution {0}", e);
View Full Code Here

     *        use the client transaction.
     * @throws Exception if an error during the tests occurs.
     */
    public void testUsingClientTransWithAppRuntimeRollbackException(final boolean canCommit) throws Exception {
        UserTransaction utx = ExceptionHandleUtil.getUserTransaction();
        utx.begin();
        try {
            sfsbContainerTransactionApp02.insertCorrectFirstErrorSecond(DATABASE_1, DATABASE_2);
            fail("The container did not re-throw the application exception.");
        } catch (RollbackAppRuntimeException e) {
            logger.debug("The bean threw an expected error during the execution {0}", e);
View Full Code Here

     * rollback in this case. The test uses a client transaction.
     * @throws Exception if an error during the tests occurs.
     */
    public void testUsingClientTransWithAppRuntimeException() throws Exception {
        UserTransaction utx = ExceptionHandleUtil.getUserTransaction();
        utx.begin();
        try {
            sfsbContainerTransactionApp01.insertCorrectFirstErrorSecond(DATABASE_1, DATABASE_2);
            fail("The container did not re-throw the application exception.");
        } catch (AppRuntimeException e) {
            logger.debug("The bean threw an expected error during the execution {0}", e);
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.