[Logo]
Forums Register Login
Question on Statefull Session bean
hello
why do I need a statefull session bean , since it remembers client calls ??
if so , why cant I use a stateless bean with HttpSession object as a parameter to it. Why is it still in existence even though everyone say that its quite a burden ??
Please help me
manas
 
Originally posted by Manas Ahlaad:
if so , why cant I use a stateless bean with HttpSession object as a parameter to it.

You can use an HttpSession to store session state instead of a Stateful Session Bean and many people do. However, I wouldn't go passing the HttpSession object around the EJB layer...
Using the HttpSession may be an alternate for storing session state in web clients but it cannot completely replace Stateful Session Beans. What if your clients are not web clients and you want to store session state on the server? You would have to use something like Stateful Session Beans since using an HttpSession would not be an option.
Originally posted by Manas Ahlaad:
Why is it still in existence even though everyone say that its quite a burden ??

Stateful Session Beans have their uses, they are just not as prevalent as Stateless Session Beans. Besides, removing them from the EJB Specification would break backwards compatibility.
[ May 05, 2003: Message edited by: Chris Mathews ]
Even if you stored SB reference on the Httpsession, that doesnot preclude the ejb container from using the same bean instance to service other clients. Therefore it will not guarantee exclusivity....
Hi,
With session U have to always ensure that the session doesn't expire so that the data put in the session is never lost.Whereas with statful bean the data can be stored in instance variables which can be activate dand passivated accordingly.
Cheers
Geeta
hi manas
Yes,outside the web context session beans stateful have their share merits.Replicating the statefull session bean functionality using stateless session bean will call for the a user information object to be passed to server every time the client issues a request,this will,in my opinion cause a network overhead.
Even in the web client context moving the session info(if present in large amounts)out of the HttpSession object to the session bean stateful will make sense from performance point of view.
william
hello ajith,
why do i need exclusivity?
i am bothered with the bean remembering me betweeen calls and do functionality no matter what instance serves me .
what do u say ? any benefits with the exclusivity
thanks
Manas
 
Originally posted by Manas Ahlaad:
hello
why do I need a statefull session bean , since it remembers client calls ??
if so , why cant I use a stateless bean with HttpSession object as a parameter to it. Why is it still in existence even though everyone say that its quite a burden ??
Please help me
manas


This post is very similar from what you asked... hope it helps
 
i am bothered with the bean remembering me betweeen calls and do functionality no matter what instance serves me .

Here is where I think that your confusion is: Stateful Session Beans are dedicated to one client. No other client has access to the same instance. Further, since they maintain state, you cannot call methods concurrently on them.
Stateless Session Beans can serve many clients during their lifetime.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Dec 11, 2017 21:50:27.