aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes ejbCreate in stateful session bean 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 "ejbCreate in stateful session bean" Watch "ejbCreate in stateful session bean" New topic
Author

ejbCreate in stateful session bean

Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1088
    
  10

Hello,
The container is supposed to maintain a pool of beans. Let's say there are 10 stateful session beans ready in a pool. During the creation of these 10 objects, the container would have called setSessionContext and ejbCreate().
As it is stateful session beans, let's say I write some code in ejbCreate that is going to setup my state initially which is crucial for my bean.

Now, when the client calls homeObject.create(), even though the bean has been already created and is present in the pool, will the container make a call to setSessionContext and ejbCreate?

Thank You,
Ranga.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Shreyas Reddy
Ranch Hand

Joined: Oct 09, 2003
Posts: 49
Unlike stateless session beans a pool is not maintained for stateful session beans. SFSB are created as the requests for the new beans come in.
Here is the flow for SFSB creation. I hope it helps:

client calls create on home
container makes EJBObject and session context
container constructs bean instance and links the bean to its ctx and ejbobject
container sends the client a stub to the ejbobject
...
...business methods invocation
...
client calls remove on either componenet or home interface
container calls ejbREmove on the b ean
container kills the bean and EJBobject
THE BEAN IS KILLED
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1088
    
  10

It's clear now.

Thanks for explaining.
Ranga.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: ejbCreate in stateful session bean