1 Reply Latest reply on Jan 4, 2007 6:48 PM by natgross

    4.0.5, cmp 2.1, session method can't catch entity createExce

    natgross

      System: Fedora 5.
      DB: IBM db2 9.1
      JVM: 5.0.9
      AS. JBoss 4.0.5GA
      persistence-manager: org.jboss.ejb.plugins.cmp.jdbc2.JDBCStoreManager2

      In the following method in a session (facade) bean:

      private void testCreate() {
       try {
       myEntityHome.create(123,1,1);
       System.out.println("This line executes EVEN when create fails!");
       } catch (CreateException ex) {
       System.out.println("This line NEVER executes!");
       }
      }
      , upon hitting any jdbc exception, JBoss first executes the method AS IF no exception was thrown, including the lines after the [failed] myEntityHome.create and NOT the lines in the catch block, and (according to the log) afterwards tries the INSERT into the db which triggers (if jdbc problem) the exception and a variety of traces all based on the jdbc error.
      How do I get JBoss to let me catch the exception and deal with it?
      Thank you all.
      nat


        • 1. Re: 4.0.5, cmp 2.1, session method can't catch entity create
          natgross

          The answer is....
          It seems like a BUG in Jboss' JDBCStoreManager2. (cmp2.x jdbc2 pm)
          I redid my jboss.xml to point to the default persistence-manager, JDBCStoreManager, and the exception is being caught as expected.

          Please, if this is NOT a bug please advise. I have this question sitting in three other forums this entire week, and people scratching their heads, and I want to verify this before I report it as a JBoss bug all over the place.

          Thank you.
          nat