Package org.springframework.jdbc.support
Class SQLExceptionSubclassTranslator
java.lang.Object
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator
org.springframework.jdbc.support.SQLExceptionSubclassTranslator
- All Implemented Interfaces:
- SQLExceptionTranslator
SQLExceptionTranslator implementation which analyzes the specific
 SQLException subclass thrown by the JDBC driver.
 Falls back to a standard SQLStateSQLExceptionTranslator if the JDBC
 driver does not actually expose JDBC 4 compliant SQLException subclasses.
 
This translator serves as the default JDBC exception translator as of 6.0.
 As of 6.2.12, it specifically introspects BatchUpdateException
 to look at the underlying exception, analogous to the former default
 SQLErrorCodeSQLExceptionTranslator.
- Since:
- 2.5
- Author:
- Thomas Risberg, Juergen Hoeller
- 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, getCustomTranslator, getFallbackTranslator, setCustomTranslator, setFallbackTranslator, translate
- 
Constructor Details- 
SQLExceptionSubclassTranslatorpublic SQLExceptionSubclassTranslator()
 
- 
- 
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
 
 
-