Regarding beanness in case of 'afterCompletion' method

In EJB 2.0 Spec Pg 81, it is said that

Pt 1:

Invoking the getCallerPrincipal and isCallerInRole methods is disallowed in the session bean methods for which the Container does not have a client security context.

Pt 2:

"Accessing resource managers and enterprise beans is disallowed in the session bean methods for which the Container does not have a meaningful transaction context or client security context."

For afterCompletion method spec says we can call isCallerInRole so that means it has Security Context, then why is it not allowed to access Resource Managers or other beans according to Pt 2?

[638 byte] By [NareshAnkuskania] at [2007-11-27 8:48:50]
# 1

You're right to point out this inconsistency. It doesn't make any sense for isCallerInRole and

getCallerPrincipal to be callable in afterCompletion, since the callback itself is not tied to a client

invocation.This was probably an oversight made in the first spec that was not removed merely

to preserve backward compatibility.

ksaksa at 2007-7-12 20:56:50 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

Hi ksaks,

Does it mean if transaction context is available, then only we can access a resource manager or any other beans?

If above is the case, eventhough there is no transaction context, we are still able to access other beans as part of callback methods like "ejbActivate" or "ejbPassivate" of statefull session bean.

or the specification itself did not clearly differentiated between with BMT & CMT

Sorry iam not implementing the code and checking wheather the concept stated is correct or wrong?

NareshAnkuskania at 2007-7-12 20:56:50 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
No, afterCompletion is not the place to be putting arbitrary business logic. It's really only there toallow the bean to modify its own state based on the outcome of the transaction commit/rollback.
ksaksa at 2007-7-12 20:56:50 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
Thanks,I think identfying beaness will become more easier when you consider the purpose of the method also.
NareshAnkuskania at 2007-7-12 20:56:50 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...