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??
public void handleEjbServiceannotation(@Observes
ProcessAnnotatedType<EjbService> annotatedType) {
AnnotatedTypeBuilder<EjbService> builder = new
AnnotatedTypeBuilder<EjbService>();
builder.readFromType(annotatedType.getAnnotatedType().getJavaClass());
builder.addToClass(new TransactionalLiteral());
annotatedType.setAnnotatedType(builder.create());
}
public class TransactionalLiteral extends AnnotationLiteral<Transactional> {
private static final long serialVersionUID = -5729507529445029857L;
}
@Stereotype
@InterceptorBinding
@Inherited
@TransactionAware
@Target({
TYPE,
METHOD })
@Retention(RUNTIME)
@Documented
public @interface Transactional {
}
@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 @interface EjbService {
}
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 <http://www.curecomp.com/>
e-Mail: [email protected] <mailto:[email protected]>
tel: +43 (0)732 9015-5563
mobile: +43 (0)664 8867 9829