2 Replies Latest reply on Dec 30, 2005 8:55 PM by Emmanuel Bernard

    How to catch exceptions thrown by EntityManager

    Pieter-Jan Malfait Newbie


      i wanna catch ConstraintViolationExceptions when persisting an entity, i noticed i had no result at first so i tried this :

      try {
       if (e.getId() == 0 ) {em.persist(e);}
       else { em.merge(e);}
       } catch (Exception exception) {
       logger.info("Caught exception from EntityManager.");

      which gives no result. it seems the exception isn't thrown by the EntityManager operations? i do see the exception in the JBoss log as usual though

      anybody got an idea ?