Interface SqlExceptionMapper

All Superinterfaces:
io.micronaut.core.order.Ordered

public interface SqlExceptionMapper extends io.micronaut.core.order.Ordered
The SQLException mapper interface. Can be used to map given SQL exceptions to some custom exceptions (for example DataAccessException and its descendents like OptimisticLockException).
Since:
4.8.0
  • Field Summary

    Fields inherited from interface io.micronaut.core.order.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Method Summary

    Modifier and Type
    Method
    Description
    @NonNull io.micronaut.data.model.query.builder.sql.Dialect
     
    @Nullable io.micronaut.data.exceptions.DataAccessException
    mapSqlException(@NonNull SQLException sqlException)
    Maps SQLException to custom DataAccessException.

    Methods inherited from interface io.micronaut.core.order.Ordered

    getOrder
  • Method Details

    • getDialect

      @NonNull @NonNull io.micronaut.data.model.query.builder.sql.Dialect getDialect()
      Returns:
      the Dialect that this mapper supports
    • mapSqlException

      @Nullable @Nullable io.micronaut.data.exceptions.DataAccessException mapSqlException(@NonNull @NonNull SQLException sqlException)
      Maps SQLException to custom DataAccessException. In case when mapper is not able to map SQLException to custom DataAccessException then result will be null indicating that mapper cannot map the exception.
      Parameters:
      sqlException - The SQL exception
      Returns:
      mapped DataAccessException from SQLException or if mapper cannot map SQLException then returns null