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).
PersistenceExceptionTranslator
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private ListableBeanFactory | |
| private volatile PersistenceExceptionTranslator |
| Access | Constructor and Description |
|---|---|
| public | PersistenceExceptionTranslationInterceptor()
Create a new PersistenceExceptionTranslationInterceptor. |
| public | PersistenceExceptionTranslationInterceptor(PersistenceExceptionTranslator
the PersistenceExceptionTranslator to use pet)Create a new PersistenceExceptionTranslationInterceptor for the given PersistenceExceptionTranslator. |
| public | PersistenceExceptionTranslationInterceptor(ListableBeanFactory
the ListableBeanFactory to obtaining all
PersistenceExceptionTranslators from beanFactory)Create a new PersistenceExceptionTranslationInterceptor, autodetecting PersistenceExceptionTranslators in the given BeanFactory. |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterPropertiesSet()
Implements org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. |
| protected PersistenceExceptionTranslator | Returns: a chained PersistenceExceptionTranslator, combining all PersistenceExceptionTranslators found in the given bean factorythe ListableBeanFactory to obtain PersistenceExceptionTranslators from bf)Detect all PersistenceExceptionTranslators in the given BeanFactory. |
| public Object | invoke(MethodInvocation
the method invocation joinpoint mi)Implements org. Implement this method to perform extra treatments before and after the invocation. |
| public void | setAlwaysTranslate(boolean alwaysTranslate)
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"). |
| public void | setBeanFactory(BeanFactory
owning BeanFactory (never beanFactory)null).
The bean can immediately call methods on the factory.Implements org. Callback that supplies the owning factory to a bean instance. |
| public void | setPersistenceExceptionTranslator(PersistenceExceptionTranslator pet)
Specify the PersistenceExceptionTranslator to use. |
| alwaysTranslate | back to summary |
|---|---|
| private boolean alwaysTranslate | |
| beanFactory | back to summary |
|---|---|
| private ListableBeanFactory beanFactory
| |
| persistenceExceptionTranslator | back to summary |
|---|---|
| private volatile PersistenceExceptionTranslator persistenceExceptionTranslator
| |
| PersistenceExceptionTranslationInterceptor | back to summary |
|---|---|
| public PersistenceExceptionTranslationInterceptor() Create a new PersistenceExceptionTranslationInterceptor. Needs to be configured with a PersistenceExceptionTranslator afterwards.
| |
| PersistenceExceptionTranslationInterceptor | back to summary |
|---|---|
| public PersistenceExceptionTranslationInterceptor(PersistenceExceptionTranslator pet) Create a new PersistenceExceptionTranslationInterceptor for the given PersistenceExceptionTranslator.
| |
| PersistenceExceptionTranslationInterceptor | back to summary |
|---|---|
| public PersistenceExceptionTranslationInterceptor(ListableBeanFactory beanFactory) Create a new PersistenceExceptionTranslationInterceptor, autodetecting PersistenceExceptionTranslators in the given BeanFactory.
| |
| afterPropertiesSet | back to summary |
|---|---|
| public void afterPropertiesSet() Implements org. Doc from org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
| |
| detectPersistenceExceptionTranslators | back to summary |
|---|---|
| protected PersistenceExceptionTranslator detectPersistenceExceptionTranslators(ListableBeanFactory bf) Detect all PersistenceExceptionTranslators in the given BeanFactory.
| |
| invoke | back to summary |
|---|---|
| public Object invoke(MethodInvocation mi) throws Throwable Implements org. Doc from org. Implement this method to perform extra treatments before and
after the invocation. Polite implementations would certainly
like to invoke
| |
| setAlwaysTranslate | back to summary |
|---|---|
| public void setAlwaysTranslate(boolean alwaysTranslate) 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 of 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 | |
| setBeanFactory | back to summary |
|---|---|
| public void setBeanFactory(BeanFactory beanFactory) throws BeansException Implements org. Doc from org. Callback that supplies the owning factory to a bean instance. Invoked after the population of normal bean properties
but before an initialization callback such as
| |
| setPersistenceExceptionTranslator | back to summary |
|---|---|
| public void setPersistenceExceptionTranslator(PersistenceExceptionTranslator pet) Specify the PersistenceExceptionTranslator to use. Default is to autodetect all PersistenceExceptionTranslators in the containing BeanFactory, using them in a chain. | |