org.springframework.jdbc.support

## Class SQLExceptionSubclassTranslator

- java.lang.Object
- - org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator
  - - org.springframework.jdbc.support.SQLExceptionSubclassTranslator

All Implemented Interfaces:
  SQLExceptionTranslator

    public class SQLExceptionSubclassTranslator
    extends AbstractFallbackSQLExceptionTranslator

`SQLExceptionTranslator` implementation which analyzes the specific `SQLException` subclass thrown by the JDBC driver.

This is only available with JDBC 4.0 and later drivers when using Java 6 or later. Falls back to a standard `SQLStateSQLExceptionTranslator` if the JDBC driver does not actually expose JDBC 4 compliant `SQLException` subclasses.

Since:
  2.5
Author:
  Thomas Risberg, Juergen Hoeller
See Also:
  `SQLTransientException`, `SQLTransientException`, `SQLRecoverableException`

### Field Summary

### Fields inherited from class org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator

`logger`

### Constructor Summary

Constructors
Constructor and Description
`SQLExceptionSubclassTranslator()`

### Method Summary

Methods
`protected DataAccessException` `doTranslate(String task, String sql, SQLException ex)` Template method for actually translating the given exception.

### Methods inherited from class org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator

`buildMessage, getFallbackTranslator, setFallbackTranslator, translate`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SQLExceptionSubclassTranslator

    public SQLExceptionSubclassTranslator()

### Method Detail

#### doTranslate

    protected DataAccessException doTranslate(String task,
                                  String sql,
                                  SQLException ex)

Description copied from class: `AbstractFallbackSQLExceptionTranslator`
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.

Specified by:
  `doTranslate` in class `AbstractFallbackSQLExceptionTranslator`
Parameters:
  `task` - readable text describing the task being attempted
  `sql` - SQL query or update that caused the problem (may be `null`)
  `ex` - the offending `SQLException`
Returns:
  the DataAccessException, wrapping the `SQLException`; or `null` if no exception match found