4 Replies Latest reply on May 13, 2010 10:09 AM by Mark Little

    failed transaction in method with REQUIRES_NEW causes failing the transaction in the calling method. WHY?

    dimitar dimitar Newbie

      Hi

      I have jboss 5.1 ejb3

      I have a simple method

       

      @TransactionAttribute(TransactionAttributeType.REQUIRED)
          public void onMessage(final Message message) {
           //extract message body
           //persist message body
      ...................
           try {
                  replicatonQueueSender.send(item);
              } catch (Exception e) {
                  log.error("item not replicated ", e);
              }
      }
      
      
      @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
          public void send(Serializable obj) {
           try {
           sender.send(createMessage(obj));
           } catch(Exception e) {
           }
      }
      

       

      All i want to know why does the transaction in onMessage fails(i.e. the persist message body fails) if there is exception in

      replicatonQueueSender.send method which is catched there. If the new transaction in send fails, why does the 
      onMessage transaction fails too. This is not per the ejb3 spec i think?