Bean post-processor that automatically applies persistence exception translation to any bean marked with Spring's @ {@link org.springframework.stereotype.Repository Repository}annotation, adding a corresponding {@link PersistenceExceptionTranslationAdvisor} tothe 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 {@link org.springframework.dao.DataAccessException DataAccessException} hierarchy.Autodetects beans that implement the {@link org.springframework.dao.support.PersistenceExceptionTranslator PersistenceExceptionTranslator} interface, which are subsequently asked to translatecandidate exceptions.
All of Spring's applicable resource factories (e.g. {@link org.springframework.orm.hibernate3.LocalSessionFactoryBean LocalSessionFactoryBean}, {@link org.springframework.orm.jpa.LocalEntityManagerFactoryBean LocalEntityManagerFactoryBean}) implement the {@code 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 Repositories or DAOs) with the {@code @Repository} annotation, along with defining this post-processoras a bean in the application context.
@author Rod Johnson
@author Juergen Hoeller
@since 2.0
@see PersistenceExceptionTranslationAdvisor
@see org.springframework.stereotype.Repository
@see org.springframework.dao.DataAccessException
@see org.springframework.dao.support.PersistenceExceptionTranslator