• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

StatelessSession ejbCreate and ejbRemove

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Nimala,
Please check out Kathy Sierra's Reply in the following thread:

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

Regards,
 
Nirmala Rayudu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Nadeem for a very useful reference(also for finding time to look it up).
 
yeah, but ... what would PIE do? Especially concerning this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic