use of org.springframework.jdbc.support.SQLExceptionTranslator in project tutorials by eugenp.
the class ExceptionTranslator method exception.
@Override
public void exception(ExecuteContext context) {
SQLDialect dialect = context.configuration().dialect();
SQLExceptionTranslator translator = new SQLErrorCodeSQLExceptionTranslator(dialect.name());
context.exception(translator.translate("Access database using jOOQ", context.sql(), context.sqlException()));
}
use of org.springframework.jdbc.support.SQLExceptionTranslator in project jOOQ by jOOQ.
the class ExceptionTranslator method exception.
@Override
public void exception(ExecuteContext ctx) {
// [#4391] Translate only SQLExceptions
if (ctx.sqlException() != null) {
SQLDialect dialect = ctx.dialect();
SQLExceptionTranslator translator = (dialect != null) ? new SQLErrorCodeSQLExceptionTranslator(dialect.thirdParty().springDbName()) : new SQLStateSQLExceptionTranslator();
ctx.exception(translator.translate("jOOQ", ctx.sql(), ctx.sqlException()));
}
}
use of org.springframework.jdbc.support.SQLExceptionTranslator in project spring-boot by spring-projects.
the class JooqExceptionTranslator method exception.
@Override
public void exception(ExecuteContext context) {
SQLExceptionTranslator translator = getTranslator(context);
// The exception() callback is not only triggered for SQL exceptions but also for
// "normal" exceptions. In those cases sqlException() returns null.
SQLException exception = context.sqlException();
while (exception != null) {
handle(context, translator, exception);
exception = exception.getNextException();
}
}
Aggregations