This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calling getEJBObject() in ejbCreate() of Stateless session bean

 
Kaarthik Sivashanmugam
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I dont understand how we can get reference to EJBObject in ejbCreate method for a stateless session bean. From what I understand, the stateless session beans are created by the container (for this the bean constructor is called and then setSessionContext, ejbCreate methods are called) and kept in pool. Till this point the bean is tied only to the context and not to any EJBObject. If this is the case, how can we call getEJBObject in ejbCreate method ? Please respond if you know the answer.

Thanks in advance.

Karthik
 
Suman Sarker
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This topic was already discussed in this forum a few days back. You may want to checkthis out.
 
Kaarthik Sivashanmugam
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply, Suman. The link you sent however did not clear my doubt. The link for the discussion you sent concludes that because getEJBObject() is possible in ejbCreate(), EJBObject should have been created before that. I could infer that while reading HFEJB. But, I am interested to know when (and how) EJBObject creation happens for stateless session bean in relation to ejbCreate(). If I have to go with the OID in page 227 of HFEJB ejbCreate is possible in a "different/unrelated" time. So it can happen before or after the "client call" create(). If it happens before the "client call". EJBObject would not have been created during ejbCreate().

Also, another related question is, if every client creates a new EJBObject, does it mean that ejbCreate is called for every client? I assume it is not. As a result, if ejbCreate can access EJBObject, which client's EJBObject are we talking about ?
 
Kaarthik Sivashanmugam
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Vipin. That was really helpful.
 
Girija Siva
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
:-) So that's what the spec says karthik
Thanks Vipin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic