users@ejb-spec.java.net

[ejb-spec users] A small interceptor question

From: Mark Struberg <struberg_at_yahoo.de>
Date: Thu, 18 Oct 2012 20:50:45 +0100 (BST)

Dear EJB EG!

We have a small question over in the CDI EG and Apache DeltaSpike regard interception of methods of a superclass.

When dealing with multiple class hierarchies of intercepted classes (@InterceptorBinding style for now) we have the 2 following use cases:


@Transactional
public class A {
  public void methodA();
}


public class B extends A {
  public void methodB();
}

Question
 1: does the @Transactional interceptor get inherited and both methodA()
 and methodB() get intercepted, or will only methodA() get intercepted? Let's
 assume the Transactional annotation itself is marked as inherited. Imo it should, right? if @Transactional doesn't have @Inherited then methodB() will not get intercepted, right?


And now for the other (bit more tricky) case:

public class A {
  public void methodA();
}

@Transactional
public class B extends A {
  public void methodB();
}

Question
 2: does the @Transactional interceptor also affect inherited methods
and both methodA() and methodB() get intercepted, or will only methodB()
 get intercepted? I found no clear answer in the interceptors spec. From the gut feeling we think methodA() should get intercepted as well...

Could you please point us to the paragraph where the behaviour got defined?
I could only find paragraphs about inherited interceptors itself, but not about inheritance behaviour of intercepted classes.

Next question while I'm at it: the behaviour of @InterceptorBinding style Interceptors and @Interceptors is the same regarding the scenarios above?


Oh and btw, the next revision please with paragraph numbers - makes it lot easiers to reference ;)

txs and LieGrue,
strub