Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-7301

JBoss v4.2.3 GenericJDBCException

XMLWordPrintable

      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 code "Throwable result = null;" .

      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.

            jpederse@redhat.com Jesper Pedersen
            gbansal80 Gaurav Bansal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 1 day
                1d
                Logged:
                Time Spent - Not Specified
                Not Specified