|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.dao.support.PersistenceExceptionTranslationInterceptor
public class PersistenceExceptionTranslationInterceptor
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).
PersistenceExceptionTranslator
Constructor Summary | |
---|---|
PersistenceExceptionTranslationInterceptor()
Create a new PersistenceExceptionTranslationInterceptor. |
|
PersistenceExceptionTranslationInterceptor(ListableBeanFactory beanFactory)
Create a new PersistenceExceptionTranslationInterceptor, autodetecting PersistenceExceptionTranslators in the given BeanFactory. |
|
PersistenceExceptionTranslationInterceptor(PersistenceExceptionTranslator persistenceExceptionTranslator)
Create a new PersistenceExceptionTranslationInterceptor for the given PersistenceExceptionTranslator. |
Method Summary | |
---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware). |
protected PersistenceExceptionTranslator |
detectPersistenceExceptionTranslators(ListableBeanFactory beanFactory)
Detect all PersistenceExceptionTranslators in the given BeanFactory. |
Object |
invoke(MethodInvocation mi)
|
void |
setBeanFactory(BeanFactory beanFactory)
Callback that supplies the owning factory to a bean instance. |
void |
setPersistenceExceptionTranslator(PersistenceExceptionTranslator pet)
Specify the PersistenceExceptionTranslator to use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PersistenceExceptionTranslationInterceptor()
setPersistenceExceptionTranslator(org.springframework.dao.support.PersistenceExceptionTranslator)
public PersistenceExceptionTranslationInterceptor(PersistenceExceptionTranslator persistenceExceptionTranslator)
persistenceExceptionTranslator
- the PersistenceExceptionTranslator to usepublic PersistenceExceptionTranslationInterceptor(ListableBeanFactory beanFactory)
beanFactory
- the ListableBeanFactory to obtaining all
PersistenceExceptionTranslators fromMethod Detail |
---|
public void setPersistenceExceptionTranslator(PersistenceExceptionTranslator pet)
Default is to autodetect all PersistenceExceptionTranslators in the containing BeanFactory, using them in a chain.
detectPersistenceExceptionTranslators(org.springframework.beans.factory.ListableBeanFactory)
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
BeanFactoryAware
Invoked after the population of normal bean properties
but before an initialization callback such as
InitializingBean.afterPropertiesSet()
or a custom init-method.
setBeanFactory
in interface BeanFactoryAware
beanFactory
- owning BeanFactory (never null
).
The bean can immediately call methods on the factory.
BeansException
- in case of initialization errorsBeanInitializationException
public void afterPropertiesSet()
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
protected PersistenceExceptionTranslator detectPersistenceExceptionTranslators(ListableBeanFactory beanFactory)
beanFactory
- the ListableBeanFactory to obtaining all
PersistenceExceptionTranslators from
ChainedPersistenceExceptionTranslator
public Object invoke(MethodInvocation mi) throws Throwable
invoke
in interface MethodInterceptor
Throwable
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |