File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes confusion on ejbCreate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "confusion on ejbCreate " Watch "confusion on ejbCreate " New topic

confusion on ejbCreate

Soni Prasad
Ranch Hand

Joined: Mar 09, 2005
Posts: 97
I have a confusion on ejbCreate method of stateless session bean that is when container calls ejbCreate to create a bean for pool EJBObject is not created then how can one permitted to call getEJBObject() method on SessionContext in ejbCreate() method.


SCJP 1.4, SCBCD 1.3
KasiMurugan Ramasamy
Ranch Hand

Joined: Jan 30, 2005
Posts: 125
Hi Soni,

A good question you have asked. When we are deploying a bean the home object would be created and bind to a JNDIName in the JNDI NameSpace, like when creating a pool for particular stateless sessionbean, first it creates the ejbobject and ejblocalObject, then only container creates the pool.

Its upto container dependent only one or more ejbObject and ejblocalObject for a particular stateless session bean.

Because these objects are only present in server(If container provides only one ejbobject and ejblocalobject), we may thing like servlet(multi thread model).

I hope it will help you.

Thanks & Regards
Kasimurugan (SCJP1.4, SCBCD1.3), Preparing SCWCD1.4
Soni Prasad
Ranch Hand

Joined: Mar 09, 2005
Posts: 97
Thanx for the answer..
ok then it means every instance in a pool is having an EJBObject but when a client calls create method on stateless bean's home an EJBObject is created then will the chosen(from pool) EJB's EJBObject be replaced by the EJBObject created by the create call?
[ July 12, 2005: Message edited by: Soni Prasad ]
Wei-ju Wu
Ranch Hand

Joined: Feb 16, 2005
Posts: 147
in fact this is a question which also bugged me for a while, thankfully, a search in this forum was pretty helpful, here is a very detailed answer by Kathy:

Link to Kathy's answer

To Kathy and Bert: you might want to include that answer as an addition to "there are no Dumb Questions" into HFEJB. I have looked up the spec and the javadoc and they really do not explain this topic well.

"The UrlyBird catches the certificate. And he's gonna FlyByNight"<br /> <br />SCJP 1.2/5.0, SCJD, SCBCD, SCWCD, SCEA
Soni Prasad
Ranch Hand

Joined: Mar 09, 2005
Posts: 97
Thank you so much Wei-ju Wu for providing this link.
I agree. Here's the link:
subject: confusion on ejbCreate
It's not a secret anymore!