Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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

SLSB creation

 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question:
According to the spec on page 89, the container calls ejbCreate() when it decides to make a stateless session bean. Now this doesn't have anything to do with a client, so there shouldn't yet be any EJBObject, not until the client calls create() on the home interface. Yet in the table on page 90, it asserts that from ejbCreate(), one can call getEJBObject() on the SessionContext. But how can this be if there is not yet an EJBObject?
Am I not reading this table properly?
C.Arthur
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is definitely one of the finer points you'll encounter on the exam .. or on the job .. if you are lucky enough to have one.
However ... in the meantime: when SLSBs are created the container knows everything about the bean in order to make it work. Therefore it can create the EJBObject at that point and put the bean in the pool. Contrast this with a CMP entity bean, where upon ejbCreate, the container doesn't know enough about the bean in order to actually create it.
For a SLSB, ejbCreate is a good time to use its context to do whatever needs to be done in preparation for client invocations. After ejbCreate it doesn't have a chance. And therefore the container needs to make it all available through the context, EJBObject, and so forth.
[Double-check all this ]
 
Hold that thought. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic