0 Replies Latest reply on Apr 24, 2008 12:17 AM by darthmaul

    Transaction Failed Message

    darthmaul

      I have the following straightforward code in my Seam component:



            try {
               widget = queryService.findByNumber(number);
      
               if (widget.isOutOfStock()) {
                  facesMessages.add("out of stock.");
               }
               else {
                  addWidgetToOrder(widget);
               }
            }
            catch (NoSuchWidgetException e) {
               facesMessages.add("There is no widget with that number.");
            }
      



      The queryService component does a basic lookup, and NoSuchWidgetException wraps the JPA NoResultException thrown  inside queryService.findByNumber if the lookup fails.


      The problem is that my <h:messages> component gets filled with the right message (There is no widget with that number.)...but then followed by a new line and the message Transaction failed. 


      Why do I get this message when I wrap the JPA exception in one of my own?  I don't want to change the text in messages.properties, so how can I get rid of this Transaction failed message in this instance?


      Thanks.