Browse Source
Introduce an jOOQ `ExecuteListener` sub-interface specifically for exception translation with the auto-configured `DefaultExecuteListenerProvider` instance. Users can now define a bean that implements the interface or omit it and continue to use the existing exception translation logic. See gh-38762pull/39276/head
4 changed files with 88 additions and 5 deletions
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
/* |
||||
* Copyright 2012-2022 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.boot.autoconfigure.jooq; |
||||
|
||||
import org.jooq.ExecuteContext; |
||||
import org.jooq.ExecuteListener; |
||||
|
||||
import org.springframework.dao.DataAccessException; |
||||
|
||||
/** |
||||
* A {@link ExecuteListener} which can transforms or translate {@link Exception} into a Spring-specific |
||||
* {@link DataAccessException}. |
||||
* |
||||
* @author Dennis Melzer |
||||
* @since 3.2.1 |
||||
*/ |
||||
public interface JooqExceptionTranslatorListener extends ExecuteListener { |
||||
|
||||
/** |
||||
* Override the given {@link Exception} from {@link ExecuteContext} into a generic {@link DataAccessException}. |
||||
* @param context The context containing information about the execution. |
||||
*/ |
||||
void exception(ExecuteContext context); |
||||
} |
||||
Loading…
Reference in new issue