Two Laptop Bag
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes StatefulSessionBean - regarding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "StatefulSessionBean - regarding" Watch "StatefulSessionBean - regarding" New topic

StatefulSessionBean - regarding

Sub swamy
Ranch Hand

Joined: Oct 02, 2002
Posts: 121
According to spec. Page 80, from with setSessionContext() method of a stateful session bean, we cannot call getCallerPrincipal() method.

For a stateful session EJB, when the setSessionContext method is run , there must have been a user who had called create which starts off the instantiation process � new instance, setSessionContext, ejbCreate. At this time why isn�t the sessionContext able to call getCallerPrincipal, isCallerInRole() methods?

Also, what happens between setSessionContext and ejbCreate methods such that in the latter we are able to call getCallerPrincipal() method?(spec. Page 80)
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
The purpose of setSessionContext is just to enable the storage of the reference to the SessionContext in an instance variable.

It is in ejbCreate where you can really start doing things as the object has been changed to an EJB. This is why client security information becomes available for the first time.

SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Mike Pandey
Ranch Hand

Joined: Dec 05, 2005
Posts: 62
But Roger, In setSessionContext(), we have the context instance available which is the lifeline to the i don't quite understand why the client security info shudn't be avaliable out in the setSessionContext()methd.
pls advice.

I agree. Here's the link:
subject: StatefulSessionBean - regarding
jQuery in Action, 3rd edition