Hi Thomas! Did you also add the <interceptors> section to your beans.xml?
LieGrue, strub >________________________________ > From: Thomas Herzog <[email protected]> >To: [email protected] >Sent: Sunday, 12 May 2013, 16:33 >Subject: CDI Extension AnnotatedTypeBuilder > > > >Hello guys > >I want to add a @Transactional annotation which has an interceptor binding to >our services within our JUnit test (Deltaspike openEjb), so that the >interceptor will take place when a service method get invoked. >The problem is that I can add the annotation to our EjbService annotation >(Stereotype) but the interceptor does not take place when a service method >gets invoked. >Do I miss something or is this not possible?? > > >publicvoidhandleEjbServiceannotation(@ObservesProcessAnnotatedType<EjbService> >annotatedType) { > AnnotatedTypeBuilder<EjbService> builder = >newAnnotatedTypeBuilder<EjbService>(); > builder.readFromType(annotatedType.getAnnotatedType().getJavaClass()); > builder.addToClass(newTransactionalLiteral()); > annotatedType.setAnnotatedType(builder.create()); > } > >publicclassTransactionalLiteral extendsAnnotationLiteral<Transactional> { > > privatestaticfinallongserialVersionUID= -5729507529445029857L; > >} > >@Stereotype >@InterceptorBinding >@Inherited >@TransactionAware >@Target({ > TYPE, > METHOD}) >@Retention(RUNTIME) >@Documented >public@interfaceTransactional{ > >} > >@Inherited >@TransactionManagement(TransactionManagementType.CONTAINER) >@TransactionAttribute(TransactionAttributeType.REQUIRED) >@TransactionAware >@Stereotype >@Logging >@ExceptionWrapping({ > @ExceptionWrap( > wrapper = ConcurrentEntityUpdateException.class, > sources = OptimisticLockException.class), > @ExceptionWrap( > wrapper = CoreException.class) }) >@Retention(RetentionPolicy.RUNTIME) >@Target(ElementType.TYPE) >public@interfaceEjbService{ >} > >When I try to add the annotation on the supertype of our service the >interceptor does not take place either. > >Thanks in advance. > >Mit freundlichen Grüßen > >Thomas Herzog >Softwareentwicklung > >curecomp Software Services GmbH >Hafenstrasse 47-51 >4020 Linz > >web: www.curecomp.com >e-Mail: [email protected] >tel: +43 (0)732 9015-5563 >mobile: +43 (0)664 8867 9829 > > > > >
