Interface SQLExceptionConversionDelegate

All Known Implementing Classes:
AbstractSQLExceptionConversionDelegate
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@SPI({USE,IMPLEMENT,SUPPLY}) @FunctionalInterface public interface SQLExceptionConversionDelegate

Converts database-specific SQL exceptions as one step in Hibernate's exception-conversion chain.

Return null when this delegate does not recognize the exception. A null result deliberately declines conversion and allows the remaining standard delegates to inspect the same exception. Implementations must not throw or manufacture a sentinel merely to indicate that they did not handle it.

Implementations should base conversion on stable vendor error codes, SQL states, or exception subtypes and preserve the supplied SQL text in the resulting JDBCException when applicable.

Since:
8.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    convert(SQLException sqlException, String message, String sql)
    Convert the given exception, or decline conversion by returning null.
  • Method Details

    • convert

      @Nullable JDBCException convert(SQLException sqlException, String message, String sql)
      Convert the given exception, or decline conversion by returning null.
      Parameters:
      sqlException - the database exception to interpret
      message - the message to use for a converted exception
      sql - the SQL statement which caused the exception
      Returns:
      the converted exception, or null when this delegate does not recognize the exception