title: Why can't I catch this EJBTransactionRolledbackException
body: <p>Server: WildFly10
  JPA with eclipseLink 2.6.3-M1
  JavaEE7</p>
  
  <p>I have the following EJB:</p>
  
  <pre><code>@Stateless
  @LocalBean
  public class HandleRollbackComponent {
  
      private static Logger logger = Logger.getLogger(HandleRollbackComponent.class);
  
      @EJB
      private Tws14WSBatchChRequestsFacade tws14wsBatchChRequestsFacade;
  
      public void doSomething() {
          // first off go and fetch an instance of tws14 from the db
          logger.debug("*************************************************");
          logger.debug("1. First off go and fetch an instance of tws14 from the db");
  
          String batchChReqId = "103";
          Tws14WSBatchChRequests tws14wsBatchChRequests = tws14wsBatchChRequestsFacade.find(new BigDecimal(batchChReqId));
          logger.debug("2. Found instance of tws14: " + tws14wsBatchChRequests);
          logger.debug("2.1 CARD PLASTIC          : " + tws14wsBatchChRequests.getCardPlastic());
  
          try {
              logger.debug("3. Now call a method that throws the EJBTrxnRollBackException....");
              doSomethingThatThrowsEJBTransactionRolledbackException(tws14wsBatchChRequests);
  
              logger.debug("---&gt; This line should not be logged if exception was thrown....");
          } catch (Exception e) {
              logger.debug("5. Caught the exception....");
          } finally {
  
              logger.debug("6. Finally try and get a fresh instance from the db again...");
              tws14wsBatchChRequests = tws14wsBatchChRequestsFacade.find(new BigDecimal(batchChReqId));
              logger.debug("7. Was able to get instance from db: " + tws14wsBatchChRequests);
  
              logger.debug("8. Try and update the instance of tws again...");
              tws14wsBatchChRequestsFacade.edit(tws14wsBatchChRequests);
              logger.debug("9. Could update the instance without problems.....");
  
              logger.debug("10. Check the OrderCards value: " + tws14wsBatchChRequests.getOrderCards() );
          }
  
          logger.debug("11. Done...");
  
      }
  
      public void doSomethingThatThrowsEJBTransactionRolledbackException(Tws14WSBatchChRequests tws14wsBatchChRequests) {
          logger.debug("4. Set some invalid values on tws14 in an attempt to get exception thrown...");
          tws14wsBatchChRequests.setOrderCards("N");
          tws14wsBatchChRequests.setOrderCards("");
          tws14wsBatchChRequests.setCardPlastic(null);
  
          tws14wsBatchChRequestsFacade.edit(tws14wsBatchChRequests);
      }
  
  }
  </code></pre>
  
  <p>When I call doSomething() this is what I see:</p>
  
  <hr>
  
  <ol>
  <li>First off go and fetch an instance of tws14 from the db</li>
  <li>Found instance of tws14: za.co.fnds.persistence.entities.Tws14WSBatchChRequests[ batchChRequestId=103 ]
  2.1 CARD PLASTIC          : NBCRFLI_PIN</li>
  <li>Now call a method that throws the EJBTrxnRollBackException....</li>
  <li><p>Set some invalid values on tws14 in an attempt to get exception thrown...</p>
  
  <p><strong>---> This line should not be logged if exception was thrown....</strong></p></li>
  <li>Finally trying to get a fresh instance from the db again...</li>
  <li>Was able to get instance from db: za.co.fnds.persistence.entities.Tws14WSBatchChRequests[ batchChRequestId=103 ]</li>
  <li>Try and update the instance of tws again...</li>
  <li>Could update the instance without problems.....</li>
  <li>Check the OrderCards value:</li>
  <li>Done...</li>
  </ol>
  
  <p>My question is why is the program not going into the catch clause because my logs indicates that a javax.validation.ConstraintViolationException was thrown. Why is the bold log above still show? What am I missing? Is there a way I'm supposed to be handling this program structure in an EJB?</p>