Java Code Examples for org.springframework.dao.support.PersistenceExceptionTranslationInterceptor

The following examples show how to use org.springframework.dao.support.PersistenceExceptionTranslationInterceptor. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: spring-analysis-note   Author: Vip-Augus   File: PersistenceExceptionTranslationAdvisor.java    License: MIT License 5 votes vote down vote up
/**
 * Create a new PersistenceExceptionTranslationAdvisor.
 * @param persistenceExceptionTranslator the PersistenceExceptionTranslator to use
 * @param repositoryAnnotationType the annotation type to check for
 */
public PersistenceExceptionTranslationAdvisor(
		PersistenceExceptionTranslator persistenceExceptionTranslator,
		Class<? extends Annotation> repositoryAnnotationType) {

	this.advice = new PersistenceExceptionTranslationInterceptor(persistenceExceptionTranslator);
	this.pointcut = new AnnotationMatchingPointcut(repositoryAnnotationType, true);
}
 
Example #2
Source Project: spring-analysis-note   Author: Vip-Augus   File: PersistenceExceptionTranslationAdvisor.java    License: MIT License 5 votes vote down vote up
/**
 * Create a new PersistenceExceptionTranslationAdvisor.
 * @param beanFactory the ListableBeanFactory to obtaining all
 * PersistenceExceptionTranslators from
 * @param repositoryAnnotationType the annotation type to check for
 */
PersistenceExceptionTranslationAdvisor(
		ListableBeanFactory beanFactory, Class<? extends Annotation> repositoryAnnotationType) {

	this.advice = new PersistenceExceptionTranslationInterceptor(beanFactory);
	this.pointcut = new AnnotationMatchingPointcut(repositoryAnnotationType, true);
}
 
Example #3
Source Project: spring-analysis-note   Author: Vip-Augus   File: PersistenceExceptionTranslationInterceptorTests.java    License: MIT License 5 votes vote down vote up
@Override
protected void addPersistenceExceptionTranslation(ProxyFactory pf, PersistenceExceptionTranslator pet) {
	if (AnnotationUtils.findAnnotation(pf.getTargetClass(), Repository.class) != null) {
		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
		bf.registerBeanDefinition("peti", new RootBeanDefinition(PersistenceExceptionTranslationInterceptor.class));
		bf.registerSingleton("pet", pet);
		pf.addAdvice((PersistenceExceptionTranslationInterceptor) bf.getBean("peti"));
	}
}
 
Example #4
Source Project: java-technology-stack   Author: codeEngraver   File: PersistenceExceptionTranslationAdvisor.java    License: MIT License 5 votes vote down vote up
/**
 * Create a new PersistenceExceptionTranslationAdvisor.
 * @param persistenceExceptionTranslator the PersistenceExceptionTranslator to use
 * @param repositoryAnnotationType the annotation type to check for
 */
public PersistenceExceptionTranslationAdvisor(
		PersistenceExceptionTranslator persistenceExceptionTranslator,
		Class<? extends Annotation> repositoryAnnotationType) {

	this.advice = new PersistenceExceptionTranslationInterceptor(persistenceExceptionTranslator);
	this.pointcut = new AnnotationMatchingPointcut(repositoryAnnotationType, true);
}
 
Example #5
Source Project: java-technology-stack   Author: codeEngraver   File: PersistenceExceptionTranslationAdvisor.java    License: MIT License 5 votes vote down vote up
/**
 * Create a new PersistenceExceptionTranslationAdvisor.
 * @param beanFactory the ListableBeanFactory to obtaining all
 * PersistenceExceptionTranslators from
 * @param repositoryAnnotationType the annotation type to check for
 */
PersistenceExceptionTranslationAdvisor(
		ListableBeanFactory beanFactory, Class<? extends Annotation> repositoryAnnotationType) {

	this.advice = new PersistenceExceptionTranslationInterceptor(beanFactory);
	this.pointcut = new AnnotationMatchingPointcut(repositoryAnnotationType, true);
}
 
Example #6
Source Project: java-technology-stack   Author: codeEngraver   File: PersistenceExceptionTranslationInterceptorTests.java    License: MIT License 5 votes vote down vote up
@Override
protected void addPersistenceExceptionTranslation(ProxyFactory pf, PersistenceExceptionTranslator pet) {
	if (AnnotationUtils.findAnnotation(pf.getTargetClass(), Repository.class) != null) {
		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
		bf.registerBeanDefinition("peti", new RootBeanDefinition(PersistenceExceptionTranslationInterceptor.class));
		bf.registerSingleton("pet", pet);
		pf.addAdvice((PersistenceExceptionTranslationInterceptor) bf.getBean("peti"));
	}
}
 
Example #7
Source Project: lams   Author: lamsfoundation   File: PersistenceExceptionTranslationAdvisor.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new PersistenceExceptionTranslationAdvisor.
 * @param persistenceExceptionTranslator the PersistenceExceptionTranslator to use
 * @param repositoryAnnotationType the annotation type to check for
 */
public PersistenceExceptionTranslationAdvisor(
		PersistenceExceptionTranslator persistenceExceptionTranslator,
		Class<? extends Annotation> repositoryAnnotationType) {

	this.advice = new PersistenceExceptionTranslationInterceptor(persistenceExceptionTranslator);
	this.pointcut = new AnnotationMatchingPointcut(repositoryAnnotationType, true);
}
 
Example #8
Source Project: lams   Author: lamsfoundation   File: PersistenceExceptionTranslationAdvisor.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new PersistenceExceptionTranslationAdvisor.
 * @param beanFactory the ListableBeanFactory to obtaining all
 * PersistenceExceptionTranslators from
 * @param repositoryAnnotationType the annotation type to check for
 */
PersistenceExceptionTranslationAdvisor(
		ListableBeanFactory beanFactory, Class<? extends Annotation> repositoryAnnotationType) {

	this.advice = new PersistenceExceptionTranslationInterceptor(beanFactory);
	this.pointcut = new AnnotationMatchingPointcut(repositoryAnnotationType, true);
}
 
Example #9
Source Project: spring4-understanding   Author: langtianya   File: PersistenceExceptionTranslationAdvisor.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a new PersistenceExceptionTranslationAdvisor.
 * @param persistenceExceptionTranslator the PersistenceExceptionTranslator to use
 * @param repositoryAnnotationType the annotation type to check for
 */
public PersistenceExceptionTranslationAdvisor(
		PersistenceExceptionTranslator persistenceExceptionTranslator,
		Class<? extends Annotation> repositoryAnnotationType) {

	this.advice = new PersistenceExceptionTranslationInterceptor(persistenceExceptionTranslator);
	this.pointcut = new AnnotationMatchingPointcut(repositoryAnnotationType, true);
}
 
Example #10
Source Project: spring4-understanding   Author: langtianya   File: PersistenceExceptionTranslationAdvisor.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a new PersistenceExceptionTranslationAdvisor.
 * @param beanFactory the ListableBeanFactory to obtaining all
 * PersistenceExceptionTranslators from
 * @param repositoryAnnotationType the annotation type to check for
 */
PersistenceExceptionTranslationAdvisor(
		ListableBeanFactory beanFactory, Class<? extends Annotation> repositoryAnnotationType) {

	this.advice = new PersistenceExceptionTranslationInterceptor(beanFactory);
	this.pointcut = new AnnotationMatchingPointcut(repositoryAnnotationType, true);
}
 
Example #11
@Override
protected void addPersistenceExceptionTranslation(ProxyFactory pf, PersistenceExceptionTranslator pet) {
	if (AnnotationUtils.findAnnotation(pf.getTargetClass(), Repository.class) != null) {
		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
		bf.registerBeanDefinition("peti", new RootBeanDefinition(PersistenceExceptionTranslationInterceptor.class));
		bf.registerSingleton("pet", pet);
		pf.addAdvice((PersistenceExceptionTranslationInterceptor) bf.getBean("peti"));
	}
}