Save This Page
Home » spring-framework-2.5.6-with-dependencies » org.springframework » dao » annotation » [javadoc | source]
org.springframework.dao.annotation
public class: PersistenceExceptionTranslationPostProcessor [javadoc | source]
java.lang.Object
   org.springframework.aop.framework.ProxyConfig
      org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor

All Implemented Interfaces:
    BeanPostProcessor, Ordered, BeanClassLoaderAware, BeanFactoryAware, Serializable

Bean post-processor that automatically applies persistence exception translation to any bean that carries the org.springframework.stereotype.Repository annotation, adding a corresponding PersistenceExceptionTranslationAdvisor to the exposed proxy (either an existing AOP proxy or a newly generated proxy that implements all of the target's interfaces).

Translates native resource exceptions to Spring's org.springframework.dao.DataAccessException hierarchy. Autodetects beans that implement the org.springframework.dao.support.PersistenceExceptionTranslator interface, which are subsequently asked to translate candidate exceptions.

All of Spring's applicable resource factories implement the PersistenceExceptionTranslator interface out of the box. As a consequence, all that is usually needed to enable automatic exception translation is marking all affected beans (such as DAOs) with the Repository annotation, along with defining this post-processor as bean in the application context.

Fields inherited from org.springframework.aop.framework.ProxyConfig:
opaque,  exposeProxy
Method from org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor Summary:
getOrder,   postProcessAfterInitialization,   postProcessBeforeInitialization,   setBeanClassLoader,   setBeanFactory,   setRepositoryAnnotationType
Methods from org.springframework.aop.framework.ProxyConfig:
copyFrom,   isExposeProxy,   isFrozen,   isOpaque,   isOptimize,   isProxyTargetClass,   setExposeProxy,   setFrozen,   setOpaque,   setOptimize,   setProxyTargetClass,   toString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor Detail:
 public int getOrder() 
 public Object postProcessAfterInitialization(Object bean,
    String beanName) throws BeansException 
 public Object postProcessBeforeInitialization(Object bean,
    String beanName) throws BeansException 
 public  void setBeanClassLoader(ClassLoader classLoader) 
 public  void setBeanFactory(BeanFactory beanFactory) throws BeansException 
 public  void setRepositoryAnnotationType(Class repositoryAnnotationType) 
    Set the 'repository' annotation type. The default required annotation type is the Repository annotation.

    This setter property exists so that developers can provide their own (non-Spring-specific) annotation type to indicate that a class has a repository role.