Hello, The head first book says that you are not allowed to access another beans methods in setSessionContext (page 228 for stateless and 196 for stateful), however I managed to do so using the following code:
Is the book incorrect or have I mis-understood something? Thanks for any help anyone can give.
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.
It also says that
If a session bean instance attempts to access a resource manager or an enterprise bean, and that access is not allowed (as state by the spec), the behavior is undefined by the EJB architecture.
So your code in theory could work it's just not gauranteed to work in all EJB containers. This hurts your EJB's potential for reusability. HFEJB is saying what is mandated by the spec so you will need to know it for the exam. Hope this helps, Mike