Top Description Fields Constructors Methods
org.springframework.jdbc.support

public Class SQLExceptionSubclassTranslator

extends AbstractFallbackSQLExceptionTranslator
Class Inheritance
Imports
java.sql.SQLDataException, .SQLException, .SQLFeatureNotSupportedException, .SQLIntegrityConstraintViolationException, .SQLInvalidAuthorizationSpecException, .SQLNonTransientConnectionException, .SQLNonTransientException, .SQLRecoverableException, .SQLSyntaxErrorException, .SQLTimeoutException, .SQLTransactionRollbackException, .SQLTransientConnectionException, .SQLTransientException, org.springframework.dao.CannotAcquireLockException, .DataAccessException, .DataAccessResourceFailureException, .DataIntegrityViolationException, .DuplicateKeyException, .InvalidDataAccessApiUsageException, .PermissionDeniedDataAccessException, .PessimisticLockingFailureException, .QueryTimeoutException, .RecoverableDataAccessException, .TransientDataAccessResourceException, org.springframework.jdbc.BadSqlGrammarException, org.springframework.lang.Nullable

SQLExceptionTranslator implementation which analyzes the specific java.sql.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 translator as of 6.0.

Authors
Thomas Risberg, Juergen Hoeller
Since
2.5
See Also
java.sql.SQLTransientException, java.sql.SQLNonTransientException, java.sql.SQLRecoverableException

Field Summary

Inherited from org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator:
logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected DataAccessException
doTranslate(String
readable text describing the task being attempted
task
,
String
the SQL query or update that caused the problem (if known)
sql
,
SQLException
the offending SQLException
ex
)

Implements abstract org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.doTranslate.

Template method for actually translating the given exception.

Inherited from org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator:
buildMessagegetCustomTranslatorgetFallbackTranslatorsetCustomTranslatorsetFallbackTranslatortranslate

Constructor Detail

SQLExceptionSubclassTranslatorback to summary
public SQLExceptionSubclassTranslator()

Method Detail

doTranslateback to summary
protected DataAccessException doTranslate(String task, String sql, SQLException ex)

Implements abstract org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.doTranslate.

Doc from org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.doTranslate.

Template method for actually translating the given exception.

The passed-in arguments will have been pre-checked. Furthermore, this method is allowed to return null to indicate that no exception match has been found and that fallback translation should kick in.

Parameters
task:String

readable text describing the task being attempted

sql:String

the SQL query or update that caused the problem (if known)

ex:SQLException

the offending SQLException

Returns:DataAccessException

the DataAccessException, wrapping the SQLException; or null if no exception match found

Annotations
@Override
@Nullable