2 Replies Latest reply on Nov 4, 2014 4:24 AM by Tom Grat

    Store entity in own WorkItemHandler

    Tom Grat Newbie

      Hello.

       

      We have own entity which we use to store data in database. We use below source code:

      Example 1
      UserTransaction ut = (UserTransaction) new InitialContext().lookup(JtaTransactionManager.DEFAULT_USER_TRANSACTION_NAME);
      ut.begin();
      EntityManager entityManager = Mediator.getInstance().getEntityManagerFactory().createEntityManager();
      ProcessIPOEntity processIPOEntity = entityManager.find(ProcessIPOEntity.class, ipoId);
      processIPOEntity.setProcessIpoConfNumber(procIPOId);
      entityManager.merge(entityManager);
      // -- commit
      ut.commit();

       

      If we use this source in main thread everything works correctly. But if we used it in our WorkItemHandler which extends AbstractLogOrThrowWorkItemHandler we had exception:

      Exception 1

      javax.transaction.NotSupportedException: nested transactions not supported

        at bitronix.tm.BitronixTransactionManager.begin(BitronixTransactionManager.java:120)

       

      Any advice how to solve this problem?