类 SQLStateSQLExceptionTranslator
- java.lang.Object
- org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator
- org.springframework.jdbc.support.SQLStateSQLExceptionTranslator
- 所有已实现的接口:
SQLExceptionTranslator
public class SQLStateSQLExceptionTranslator extends AbstractFallbackSQLExceptionTranslator
SQLExceptionTranslatorimplementation that analyzes the SQL state in theSQLExceptionbased on the first two digits (the SQL state "class"). Detects standard SQL state values and well-known vendor-specific SQL states.Not able to diagnose all problems, but is portable between databases and does not require special initialization (no database vendor detection, etc.). For more precise translation, consider
SQLErrorCodeSQLExceptionTranslator.- 作者:
- Rod Johnson, Juergen Hoeller, Thomas Risberg
- 另请参阅:
SQLException.getSQLState(),SQLErrorCodeSQLExceptionTranslator
字段概要
从类继承的字段 org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator
logger
构造器概要
构造器 构造器 说明 SQLStateSQLExceptionTranslator()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected DataAccessExceptiondoTranslate(String task, String sql, SQLException ex)Template method for actually translating the given exception.从类继承的方法 org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator
buildMessage, getFallbackTranslator, setFallbackTranslator, translate
构造器详细资料
SQLStateSQLExceptionTranslator
public SQLStateSQLExceptionTranslator()
方法详细资料
doTranslate
protected DataAccessException doTranslate(String task, String sql, SQLException ex)
Template method for actually translating the given exception.The passed-in arguments will have been pre-checked. Furthermore, this method is allowed to return
nullto indicate that no exception match has been found and that fallback translation should kick in.- 指定者:
doTranslate在类中AbstractFallbackSQLExceptionTranslator- 参数:
task- readable text describing the task being attemptedsql- the SQL query or update that caused the problem (if known)ex- the offendingSQLException- 返回:
- the DataAccessException, wrapping the
SQLException; ornullif no exception match found