Announcement Announcement Module
Collapse
No announcement yet.
Open new transaction in @AfterJob event? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Open new transaction in @AfterJob event?

    Hi,

    Is it possible to open a new transaction in @AfterStep or @AfterJob event?

    I am seeing that when I try to execute a SQL query the current transaction is closed.




    Thanks,

  • #2
    There's nothing stopping you from wrapping those calls in your own transactions. However, there is nothing within the framework that provides those methods to be transactional.

    Comment


    • #3
      Finally, I solved this problem by opening manually the transaction:

      TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager);
      totImp = transactionTemplate.execute(new TransactionCallback<BigDecimal>() {

      @Override
      public BigDecimal doInTransaction(TransactionStatus status) {
      (some code....)
      }
      });


      Any better idea?


      Thanks,

      Comment

      Working...
      X