• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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 City calls upon her steadfast protectors. Now for a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic