Originally posted by Shiang Wang:
EJBObject already exists in the container before setSessionContext() is called, why can't I call getEJBObject() on SessionContext in setSessionContext?
The reasons for disallowing operations in Table 3:
Invoking the getEJBObject and getEJBLocalObject methods is disallowed in the session bean methods in which there is no session object identity associated with the instance
Invoking the getEJBObject and getEJBHome methods is disallowed if the session bean does not define a remote client view
Originally posted by Rajan Murugan:
There can be multiple scenarios one may foresee.Assuming the spec is true as for as the table (page 90) and the oids (page 92) are concerned then no logical explanation exists.The reason being as quoted on page 90 is...
if these statements are what they imply and the table says it is allowed in ejbCreate both in cmt and bmt bean.what does it say.one possible explanation that possible is ejbCreate gets called not after setSessionContext but after EJBObject creation.Then you have the session object and the client identity too.
Originally posted by Rohit Bhagwat:
Hello friends, Rajan
Please correct me if I am wrong.
EJBObject is created just before container calls ejbCreate method when client calls create on the bean which can either be stateless or statefull.
So in either case you can get EJBObject using SessionContext object in ejbCreate method which is what the table says for both stateless and statefull beans in specs.
Rajan this is what you were trying to explain me right ?
But this statement violates the information shown in Fig 12 article 7.9.1 in the EJB 2.0 specs which says EJBObject is created only when client calls create method.
Thanks and Regards
[ October 14, 2006: Message edited by: Rohit Bhagwat ]