I have written a cdi extension which should add a @Transactional annotation
to our @EjbService annotation which is a Stereotype and bundles all
annotations which are needed by our EJB Services.
I want to annotate it because for our JUnit tests so that we do not have to
wrap the service invocations in a TransactionalService which rpovides the
transaction.
The problem is that the TransactionalInterceptor (@Transactional) is not
taking place.
When I annotate a CDI bean (non EJB) then it works fine.
I assume that the problem is that the openEjb container has already loaded
the EJBs.
Is there a restirction i do not know ?
Is there a way to get the interceptor to be invoked ?
Is it possible to add the inteceptor the proxy via cdi extension ?
deltaspike-cdictrl-openejb-0.3-incubating.jar
openejb-lite-4.5.0.jar
@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 {
}
@InterceptorBinding
@Target({
TYPE,
METHOD })
@Retention(RUNTIME)
@Documented
public @interface Transactional {
}
public void handleEjbServiceannotation(@Observes
ProcessAnnotatedType<EjbService> annotatedType) {
AnnotatedTypeBuilder<EjbService> builder = new
AnnotatedTypeBuilder<EjbService>();
builder.readFromType(annotatedType.getAnnotatedType());
builder.addToClass(AnnotationInstanceProvider.of(Transactional.class));
annotatedType.setAnnotatedType(builder.create());
}
public class Test extends BaseTest {
private static final long serialVersionUID = 6287613662143954294L;
@Inject
private Service service;
}
--
View this message in context:
http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ProcessAnnotatedType-with-EJB-deltaspike-cdictrl-openejb-lite-tp4655019.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at
Nabble.com.