0 Replies Latest reply on Nov 23, 2009 7:43 AM by Roded Hess

    Runtime Exception Makes trasaction Inactive

    Roded Hess Newbie

      I have the following code:

      @PersistenceContext(unitName = "FrontEndDB")
       private EntityManager frontendManager;
      
       @TransactionAttribute(TransactionAttributeType.REQUIRED)
       public void persistData(List<SomeData> dataEntities) {
       //Persist data
       for (SomeData data : dataEntities) {
       try {
       frontendManager.persist(data);
       } catch (Exception e) {
       log.error("Error while persisting some data " + SomeData.class.getName() + " entity.", e);
       }
       }
       }
      
      I call through a local EJB to the above method.
      If some sort of runtime exception occurs in the try block, the next iteration fails due to transaction not active.
      
      I expect the transaction to end when the method ends regardless the exception.
      
      What can I do to reactive the transaction?
      Should I do that?
      
      Thanks,
      Rod