@Override public void begin(TransactionContext context) { TransactionDefinition definition = new DefaultTransactionDefinition( TransactionDefinition.PROPAGATION_NESTED); TransactionStatus status = this.transactionManager.getTransaction(definition); context.transaction(new SpringTransaction(status)); }
@Override public void commit(TransactionContext ctx) { this.transactionManager.commit(getTransactionStatus(ctx)); }
@Override public void rollback(TransactionContext ctx) { this.transactionManager.rollback(getTransactionStatus(ctx)); }
private TransactionStatus getTransactionStatus(TransactionContext ctx) { SpringTransaction transaction = (SpringTransaction) ctx.transaction(); return transaction.getTxStatus(); }