com.interface21.jdbc.core
Class SQLErrorCodeSQLExceptionTranslater

java.lang.Object
  |
  +--com.interface21.jdbc.core.SQLErrorCodeSQLExceptionTranslater
All Implemented Interfaces:
SQLExceptionTranslater

public class SQLErrorCodeSQLExceptionTranslater
extends java.lang.Object
implements SQLExceptionTranslater

Implementation of SQLExceptionTranslator that uses specific vendor codes defined in a configuration file named "sql-error-codes.xml". More precise than SQLState implementation, but vendor specific. The JdbcTemplate class enables error handling to be parameterized without making application's dependent on a particular RDBMS.

Author:
Rod Johnson, Thomas Risberg

Field Summary
protected  org.apache.commons.logging.Log logger
           
protected  SQLErrorCodes sqlErrorCodes
          Error codes available to subclasses
 
Constructor Summary
SQLErrorCodeSQLExceptionTranslater()
           
SQLErrorCodeSQLExceptionTranslater(SQLErrorCodes sec)
           
 
Method Summary
 void setSqlErrorCodes(SQLErrorCodes sec)
          set the error codes to be used for translation
 DataAccessException translate(java.lang.String task, java.lang.String sql, java.sql.SQLException sqlex)
          Translate the given SQL exception into a generic data access exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger

sqlErrorCodes

protected SQLErrorCodes sqlErrorCodes
Error codes available to subclasses
Constructor Detail

SQLErrorCodeSQLExceptionTranslater

public SQLErrorCodeSQLExceptionTranslater()

SQLErrorCodeSQLExceptionTranslater

public SQLErrorCodeSQLExceptionTranslater(SQLErrorCodes sec)
Method Detail

setSqlErrorCodes

public void setSqlErrorCodes(SQLErrorCodes sec)
set the error codes to be used for translation

translate

public DataAccessException translate(java.lang.String task,
                                     java.lang.String sql,
                                     java.sql.SQLException sqlex)
Description copied from interface: SQLExceptionTranslater
Translate the given SQL exception into a generic data access exception.
Specified by:
translate in interface SQLExceptionTranslater
See Also:
SQLExceptionTranslater.translate(String, String, SQLException)


Rod Johnson and Spring contributors 2001-2003.