• 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:

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 ]
 
The airline is called "Virgin"? Don't you want a plane to go all the way? This tiny ad will go all the way:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic