This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes why do u require stateful session bean if no instance variable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "why do u require stateful session bean if no instance variable?" Watch "why do u require stateful session bean if no instance variable?" New topic
Author

why do u require stateful session bean if no instance variable?

Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
Instance variables are used to store the values between method invocation in the stateful session bean. If there is no variable then what is the use of declaring the bean as stateful?
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
I read your question as "Why make a session bean stateful if it doesn't maintain any state?" The answer is "Insanity."

Use stateful session beans only when you must maintain state for the client in the bean itself. Many times you can simply pass in the state (which the client maintains) as parameters to a stateless session bean.
Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
Originally posted by David Harkness:
I read your question as "Why make a session bean stateful if it doesn't maintain any state?" The answer is "Insanity."

Use stateful session beans only when you must maintain state for the client in the bean itself. Many times you can simply pass in the state (which the client maintains) as parameters to a stateless session bean.


Hi David,

I just want to make sure that the answer is correct
 
wood burning stoves
 
subject: why do u require stateful session bean if no instance variable?
 
Similar Threads
stateful session bean passivation
instance variable in session EJB
Session bean
Clear difference between stateless and stateful beans
Session Bean Doubt