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

stateless vs stateful session beans

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

I have read that in case of stateful session bean - every invocation which is performed on the same proxy reference will be handled by the same bean instance. I wonder how it is possible.
In servlets cookies have to be enabled (or URL rewritting, or hidden fields) in order to maintain conversational state. But I have not encountered on such requirement in case of stateful session beans. It seems that is is held automagically . Can someone reveal this secret?

Cheers!


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3178
    
    3
I am not sure about low level mechanism, but note: HTTPS does not need cookies to track the client (from servlet specifications), so I assume that some secured protocol used to invoke session bean and for sure if it's secured then the client must be known.


Free SCDJWS 5.0 Study Guide - SCDJWS 5.0 Quiz (How to get SCDJWS 5.0 Quiz)
Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz
ramesh vanka
Greenhorn

Joined: Mar 13, 2005
Posts: 11
StatefulSession Bean:

Once client calls the Home.create() method, container creates EJBObject, Instanstiate the Session Bean and makes relation between ejbobject and sessionbean, then it will send EJBObject stub to client.

For each every client, container creates unique session bean.

So here one point to observer is, container makes the relationship between ejbobject and sessionbean.

When ever client makes call business method (Stub EJBObject), then in server side container will come into picture pick the corresponding bean to perform the business method.

Regards,
Ramesh V
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
One other possibility to associate a certain proxy instance with a specific stateful EJB instance is that the proxy attaches some kind of identification token to the call that is made to the EJB. The EJB does not receive the call directly, but instead it goes to some kind of facade which, based on the identification token in the call selects the appropriate bean instance to serve the call.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: stateless vs stateful session beans
 
Similar Threads
No concurrent calls on stateful beans exception
how to deal with session if you have both servlet and EJB ?
SFSB or SLSB?
Scope of an EJB session
Stateful session bean