0 Replies Latest reply on Feb 11, 2010 6:45 PM by Jaaouane Aymen

    Problem with handling exceptions with seam

    Jaaouane Aymen Newbie
      Hello , i have an event handler which is a POJO seam component.
      this is the button that triggers the event.
      <h:commandButton value="save" action="#{accountManager.save}" />

      accountManager delegates the save action to an EJB
      public void save() {
      accountAction.update(selectedUser);
      StatusMessages.instance().addFromResourceBundle(Severity.INFO, "successMessage");
      }

      my problem is that when an exception occurs, the message of success is also displayed because the transaction is committed after the end of the save method and not in the middle of the save method, (the transaction is not committed after the update method which is an EJB method).
      so, my first question is why the transaction is committed after the end of the save method and not after the end of the update method.As i read, the life cycle of a transaction is the EJB method. Is the life cycle of transaction has changed because i am using seam?
      Please who can explain me when a transaction is started and when a transaction is committed when we are using seam with EJB.

      And my second question is how i can resolve this problem of the success message that is displayed when an exception occurs? when an exception occurs, both the message of exception and message of success are displayed.
      Please help me, my project in stuck.