-
Bug
-
Resolution: Obsolete
-
Major
-
JBossAS-4.2.3.GA
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
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.