org.springframework.dao.support.PersistenceExceptionTranslationInterceptor Java Examples

The following examples show how to use org.springframework.dao.support.PersistenceExceptionTranslationInterceptor. 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 File: PersistenceExceptionTranslationAdvisor.java    From spring-analysis-note with 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 File: PersistenceExceptionTranslationAdvisor.java    From spring-analysis-note with 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 File: PersistenceExceptionTranslationInterceptorTests.java    From spring-analysis-note with 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 File: PersistenceExceptionTranslationAdvisor.java    From java-technology-stack with 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 File: PersistenceExceptionTranslationAdvisor.java    From java-technology-stack with 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 File: PersistenceExceptionTranslationInterceptorTests.java    From java-technology-stack with 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 File: PersistenceExceptionTranslationAdvisor.java    From lams with 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 File: PersistenceExceptionTranslationAdvisor.java    From lams with 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 File: PersistenceExceptionTranslationAdvisor.java    From spring4-understanding with 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 File: PersistenceExceptionTranslationAdvisor.java    From spring4-understanding with 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
Source File: PersistenceExceptionTranslationInterceptorTests.java    From spring4-understanding with Apache License 2.0 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"));
	}
}