@Test(expected = ApplicationException.class) public void beginAndCommitNewTransaction() throws Exception { transactionFactory.expectActiveTransaction(); transactionFactory.expectSuspendTransaction(); transactionFactory.expectBeginTransaction(); transactionFactory.expectCommitTransaction(); transactionFactory.expectResumeTransaction(); transactionFactory.replay(); try { InvocationContext ic = createNiceMock(InvocationContext.class); expect(ic.proceed()).andThrow(new ApplicationException()); replay(ic); interceptor.applyTransaction(ic); } finally { transactionFactory.verify(); } }
@AroundInvoke public Object applyTransaction(InvocationContext ic) throws Exception { TransactionManager transactionManager = null; Transaction transaction = null; if (isTransactionActive()) { transactionManager = getTransactionManager(); transaction = transactionManager.suspend(); } try { return super.applyTransaction(ic); } finally { if (transactionManager != null && transaction != null) { transactionManager.resume(transaction); } } }
RequiresNewTransactionInterceptor extends RequiredTransactionInterceptor { @AroundInvoke public Object applyTransaction(InvocationContext ic) throws Exception { TransactionManager transactionManager = null; Transaction transaction = null; if (isTransactionActive()) { transactionManager = getTransactionManager(); transaction = transactionManager.suspend(); } try { return super.applyTransaction(ic); } finally { if (transactionManager != null && transaction != null) { transactionManager.resume(transaction); } } } }
RequiresNewTransactionInterceptor extends RequiredTransactionInterceptor { @AroundInvoke public Object applyTransaction(InvocationContext ic) throws Exception { TransactionManager transactionManager = null; Transaction transaction = null; if (isTransactionActive()) { transactionManager = getTransactionManager(); transaction = transactionManager.suspend(); } try { return super.applyTransaction(ic); } finally { if (transactionManager != null && transaction != null) { transactionManager.resume(transaction); } } }  }
RequiresNewTransactionInterceptor extends RequiredTransactionInterceptor { @AroundInvoke public Object applyTransaction(InvocationContext ic) throws Exception { TransactionManager transactionManager = null; Transaction transaction = null; if (isTransactionActive()) { transactionManager = getTransactionManager(); transaction = transactionManager.suspend(); } try { return super.applyTransaction(ic); } finally { if (transactionManager != null && transaction != null) { transactionManager.resume(transaction); } } }  @AroundInvoke Object applyTransaction(InvocationContext ic); }
RequiresNewTransactionInterceptor extends RequiredTransactionInterceptor { @AroundInvoke public Object applyTransaction(InvocationContext ic) throws Exception { TransactionManager transactionManager = null; Transaction transaction = null; if (isTransactionActive()) { transactionManager = getTransactionManager(); transaction = transactionManager.suspend(); } try { return super.applyTransaction(ic); } finally { if (transactionManager != null && transaction != null) { transactionManager.resume(transaction); } } }  @AroundInvoke Object applyTransaction(InvocationContext ic);  }