Package org.springframework.jdbc.support
Class SQLStateSQLExceptionTranslator
java.lang.Object
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator
org.springframework.jdbc.support.SQLStateSQLExceptionTranslator
- All Implemented Interfaces:
- SQLExceptionTranslator
SQLExceptionTranslator implementation that analyzes the SQL state in
 the SQLException based 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.
 
This translator is commonly used as a fallback
 behind a primary translator such as SQLErrorCodeSQLExceptionTranslator or
 SQLExceptionSubclassTranslator.
- Author:
- Rod Johnson, Juergen Hoeller, Thomas Risberg
- See Also:
- 
Field SummaryFields inherited from class org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslatorlogger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected DataAccessExceptiondoTranslate(String task, String sql, SQLException ex) Template method for actually translating the given exception.Methods inherited from class org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslatorbuildMessage, getFallbackTranslator, setFallbackTranslator, translate
- 
Constructor Details- 
SQLStateSQLExceptionTranslatorpublic SQLStateSQLExceptionTranslator()
 
- 
- 
Method Details- 
doTranslate@Nullable protected DataAccessException doTranslate(String task, @Nullable String sql, SQLException ex) Description copied from class:AbstractFallbackSQLExceptionTranslatorTemplate 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.- Specified by:
- doTranslatein class- AbstractFallbackSQLExceptionTranslator
- Parameters:
- task- readable text describing the task being attempted
- sql- the SQL query or update that caused the problem (if known)
- ex- the offending- SQLException
- Returns:
- the DataAccessException, wrapping the SQLException; ornullif no exception match found
 
 
-