0 Replies Latest reply on Nov 26, 2008 3:00 PM by asaf sh

    Problem with transaction management.

    asaf sh Expert


      I have a stateless EJB3 class that configured with a timer,

      When the timer times out, it invokes several methods,
      At the end, it perform some modifications via EntityManager and commits the transaction,

      My problem is that in the middle of that long running method that times out, I have a some 'plugins' that loads other EJBs via the InitialContext,

      When one of the methods in the loaded EJBs throw exception, it seems like the container rollback the transaction,

      When the failure thrown to the original method and tries to perform some modifications in the database via EntityManager, I get the following error:

      23:13:38,858 ERROR [TimerImpl] Error invoking ejbTimeout:javax.ejb.EJBException: javax.persistence.TransactionRequiredException: Entity
      Manager must be access within a transaction

      If non of the internal ejbs throw exceptions everything works properly and the long running method succeed to perform database modifications

      I guess nested transactions are not supported, is there any other way to handle such a situation?

      Thanks in advanced,