3 Replies Latest reply on Dec 15, 2006 1:15 PM by Gavin King

    Transaction failed faces message

    francesco milesi Newbie

      Hi everybody,

      I'm making some experiment with a class that extends EntityHome and overrides persist() in this way (I need to show customized error messages when database constraints are violated):

       @Override
       @Transactional
       public String persist() {
       try {
       return super.persist();
       } catch (Exception e) {
       facesMessages.addFromResourceBundle(SEVERITY_INFO, getMessageKeyPrefix() + "unique", "I got an error" );
       return "persist";
       }
       }
      


      When I insert a record that violates a constraint, I catch the exception and add a faces message. The problem is that the <h:messages tag in my page shows my message plus another one that says "Transaction failed", That message seems to be added by the framework after the persist() method has returned. Where does that come from ? How can I eliminate or hide it ?

      Thanks in advance for helping

      Ciao Francesco