• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJBObject

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In the spec it says that in ejbCreate of Stateless Session Bean, we can get the reference of EJBObject. But as I know when container calls ejbCreate of Stateless it doesn't bind the bean to EJBObject yet.
So how can ejbCreate can access EJBObject then ?
Please give me a light ...
Thanks
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good question.
The container associates the EJBObject to the session bean instance before calling ejbCreate() on that instance. Because there is no reason to believe otherwise
The OID in the spec (figure 6 - page 83) clearly shows how a session object gets created.
How and exactly when the EJBObject is bound to the session context is container implementation specific.
 
Amin Rais
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.
I understand what you said in your reply, your explaination is right for Statefull Session Bean.
In Stateless Session Bean, Page 90 of the spec it says that ejbCreate can access EJBObject. On the other hand in page 94 of the spec, it doesn't write EJBObject in the sequence diagram. Thus EJBObject is not available yet... so how can we access EJBObject from ejbCreate then ? this really confuses me...
Any more help ?
[ November 09, 2003: Message edited by: Amin Rais ]
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy,
Amin, this one used to bother me too... for exactly the same reason. But the best way to think about it is that for a *stateLESS* bean, the EJB object is not tied to a particular bean anyway, so the Container can do whatever it wants to make it work. For example, if you have a stateless bean, and it wants to give a reference to itself to someone else, inside its ejbCreate() method, it can ask for a reference to its EJB object. But... we don't see the EJB object being made yet? That doesn't matter, because the bean isn't *really* tied to a particular EJB object, since each stateless bean is the same as the rest, and each EJB object for a stateless bean is the same as the rest. So a stateless bean just needs a reference to *something* that acts as "an EJB object for any stateless bean of this type."
Again, if I give someone a reference to my EJB object, and I'm a stateless bean, I'm not REALLY giving them a reference to ME -- this exact stateless bean. Instead, I'm giving them a *generic* EJB object reference that will work for ANY bean of that type.
I guess the real answer is "don't worry about it -- the Container takes care of making it work." And that's all we know. It's up to the Container to implement it any way that they want. Remember that the diagrams in the spec are merely "examples of how it MIGHT be implemented" but they do not represent the actual way that it MUST be implemented. The diagrams are more *conceptual* -- giving you a way to THINK about it, even if behind the scenes the Container is doing something very different. The only thing you care about is that the Container is required to make it BEHAVE as though things are implemented exactly as they are shown in the diagram. But how many real objects, and of which type, are actually created is a completely different story...
cheers,
Kathy
 
Amin Rais
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kathy....
Thanks for the reply, your reply is really amazing !
Also for my question in other Thread.
Thanks so much..... now I don't feel confuse anymore
 
reply
    Bookmark Topic Watch Topic
  • New Topic