3 Replies Latest reply on Sep 2, 2009 11:17 AM by jaikiran pai

    How to catch JTA/JPA exception?

    Milan Vasic Newbie


      Is there a way to catch exception when transaction fail?

      Simple scenario:
      - MDB receives the message
      - onMessage() try DB access (JPA provider is Hibernate)
      - DB operation fails

      onMessage() method returns without exception. Just after it's finished, exception is thrown: javax.transaction.RollbackException (caused by java.sql.*Exception).

      So, I need to (explicitly) handle any exception that might be a cause of transaction failure. Is there any idea how to do that?

      Thanks for your attention!