open class PersistenceExceptionTranslationInterceptor : MethodInterceptor, BeanFactoryAware, InitializingBean
AOP Alliance MethodInterceptor that provides persistence exception translation based on a given PersistenceExceptionTranslator.
Delegates to the given PersistenceExceptionTranslator to translate a RuntimeException thrown into Spring's DataAccessException hierarchy (if appropriate). If the RuntimeException in question is declared on the target method, it is always propagated as-is (with no translation applied).
Author
Rod Johnson
Author
Juergen Hoeller
Since
2.0
See Also
PersistenceExceptionTranslator
PersistenceExceptionTranslationInterceptor()
Create a new PersistenceExceptionTranslationInterceptor. Needs to be configured with a PersistenceExceptionTranslator afterwards. PersistenceExceptionTranslationInterceptor(pet: PersistenceExceptionTranslator)
Create a new PersistenceExceptionTranslationInterceptor for the given PersistenceExceptionTranslator. PersistenceExceptionTranslationInterceptor(beanFactory: ListableBeanFactory)
Create a new PersistenceExceptionTranslationInterceptor, autodetecting PersistenceExceptionTranslators in the given BeanFactory. |
open fun afterPropertiesSet(): Unit |
|
open fun invoke(mi: MethodInvocation): Any |
|
open fun setAlwaysTranslate(alwaysTranslate: Boolean): Unit
Specify whether to always translate the exception ("true"), or whether throw the raw exception when declared, i.e. when the originating method signature's exception declarations allow for the raw exception to be thrown ("false"). Default is "false". Switch this flag to "true" in order to always translate applicable exceptions, independent from the originating method signature. Note that the originating method does not have to declare the specific exception. Any base class will do as well, even |
|
open fun setBeanFactory(beanFactory: BeanFactory): Unit |
|
open fun setPersistenceExceptionTranslator(pet: PersistenceExceptionTranslator): Unit
Specify the PersistenceExceptionTranslator to use. Default is to autodetect all PersistenceExceptionTranslators in the containing BeanFactory, using them in a chain. |