Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

StatelessSession ejbCreate and ejbRemove  RSS feed

 
Nirmala Rayudu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In version 2.1 of the EJB Spec, for Stateless session beans it states that ejbCreate and ejbRemove methods can access getEJBObject() and getEJBLocalObject() methods of the SessionContext. However if one looks at the Object Interaction Diagrams from page 103 - page 108 of the Spec, one can clearly see that ejbCreate and ejbRemove have nothing to do with create and remove calls issued by Client. EJBObject always corresponds to the Client. If the client does not exist, then there is no EJBObject instance for that stateless bean.

My question is, since ejbCreate and ejbRemove method calls are independent of the existence of clients(Container can just decide to create a bunch of bean instances and pool them in method-ready state even before a single client makes a create call), how come the Spec says that these methods can access the EJBObject instance for that particular instance of the bean? How is this possible?





Thanks
 
Nirmala Rayudu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can think of following case where this would be possible

All that the Spec means when it says that EJB Object references are can be retrieved from ejbCreate and ejbRemove it that the container is not going to throw IllegalStateException when those methods call getEJBObject or getEJBLocalObject on SessionContext and that the value returned would always be null.
 
Nirmala Rayudu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well my assumption stated above proved wrong. I tested this on Sun's Application Server.

Please try to clear this up for me, if anybody out there has a clear picture of how this possible.

Thanks
 
Nadeem Awad
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Nimala,
Please check out Kathy Sierra's Reply in the following thread:

http://www.coderanch.com/t/159060/java-EJB-SCBCD/certification/ejbCreate-Stateless-Session-Bean

Regards,
 
Nirmala Rayudu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nadeem for a very useful reference(also for finding time to look it up).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!