Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.jdbc.support
Interface SQLExceptionTranslator

All Known Implementing Classes:
  SQLErrorCodeSQLExceptionTranslator, SQLStateSQLExceptionTranslator

    public interface SQLExceptionTranslator

Strategy interface for translating between `SQLExceptions` and Spring's data access strategy-agnostic `DataAccessException` hierarchy.

Implementations can be generic (for example, using `SQLState` codes for JDBC) or wholly proprietary (for example, using Oracle error codes) for greater precision.

Author:
  Rod Johnson, Juergen Hoeller
See Also:
  `DataAccessException`

Method Summary
`DataAccessException` | `translate(String task, String sql, SQLException ex)` Translate the given `SQLException` into a generic `DataAccessException`.

Method Detail

### translate

    DataAccessException translate(String task,
                                  String sql,
                                  SQLException ex)

  Translate the given `SQLException` into a generic `DataAccessException`.

  The returned DataAccessException is supposed to contain the original `SQLException` as root cause. However, client code may not generally rely on this due to DataAccessExceptions possibly being caused by other resource APIs as well. That said, a `getCause() instanceof SQLException` check (and subsequent cast) is considered reliable when expecting JDBC access to have happened.

  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`
  See Also:
    `NestedRuntimeException.getCause()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2007 The Spring Framework.