1 Reply Latest reply on Apr 16, 2009 1:25 PM by nickarls

    The demise of a conversation

    nickarls

      JBoss 4.2.2.GA / JDK 6, Seam 2.1.1GA, POJO


      I have the unfortunate situation where I persist an entity (let's call it an Order) but a database trigger can throw an exception if the saving is not allowed (due to more complicated DB-related constraints/logic).


      When I persist, I can catch the PersistenceException, do a addFacesMessage and wrap it in an @ApplicationException. In pages.xml I have a


           <exception class="java.sql.BatchUpdateException">
                <redirect view-id="/main.xhtml">
                     <message>BatchUpdateException</message>
                </redirect>
           </exception>
      



      When I persist the entity the following happens



      1. I go to the main page. Fine

      2. I see the BatchUpdateException message. Fine.

      3. I get a new conversation (even if I didn't request endConversation in pages.xml)

      4. The message I added in my action is lost.

      5. New transaction is alive (due to new conversation). Fine.



      The DB exception is fatal for the transaction(?) but is there some form of semi-graceful way of handling this situation?

        • 1. Re: The demise of a conversation
          nickarls

          The RollbackInterceptor correctly notices that no rollback is required
          The BijectionInterceptor correctly notices that no ending of conversation is required


          But then the ExceptionFilter can't find a Manager (and then goes on the temp conversation route)


          Theories?