2 Replies Latest reply on Sep 30, 2009 5:12 AM by Gaurav Bansal

    JBoss v4.2.3 GenericJDBCException

    Gaurav Bansal Newbie

      We are using JBoss AS v 4.2.3. We found that in case of database specific exception for constraints (like unique , referential integrity), we are getting GenericJDBCException and not database specific exceptions like ConstraintViolationException.

      On debugging we found that we are getting GenericJDBCException due to following code available in the class org.jboss.resource.adapter.jdbc.WrappedConnection which is packaged in the jboss-common-jdbc-wrapper.jar.



      protected SQLException checkException(Throwable t) throws SQLException
      {
      Throwable result = null;
      if (mc != null)
      result = mc.connectionError(t);
      if (result instanceof SQLException) {
      throw (SQLException) result;
      } else  {
      throw new NestedSQLException("Error", result);
      }
        }


      As a fix for the problem, we commented the text in bold in the above code extract. After making the above changes, we compiled and build JBoss source code.

      With the modified jboss-common-jdbc-wrapper.jar, we are now getting correct db exceptions for e.g. incase of unique constraint violation, org.hibernate.exception.ConstraintViolationException is reported.

      Let us know if there is already a fix for this issue. If not should we raise a jira request for this?

        • 1. Re: JBoss v4.2.3 GenericJDBCException
          jaikiran pai Master

           

          "gbansal80" wrote:

          Let us know if there is already a fix for this issue. If not should we raise a jira request for this?


          From what i see in the latest code for that class, it's still the same. Also i don't see any JIRA for this. So feel free to open a JIRA for this here https://jira.jboss.org/jira/browse/JBAS and if possible attach a sample application which reproduces this issue.


          As a fix for the problem, we commented the text in bold in the above code extract. After making the above changes, we compiled and build JBoss source code.


          Since you already have spent efforts in building, fixing/patching the AS, let us know if you would want to contribute the patch. We can then guide you on the process of providing the patch.



          • 2. Re: JBoss v4.2.3 GenericJDBCException
            Gaurav Bansal Newbie

            I have created the JIRA (JBAS-7301) for this issue. I would like to contribute the fix.

            Appreciate if you guide what are the steps involved in contributing the code.

            Thanks,