• Post Reply Bookmark Topic Watch Topic
  • New Topic

help in Stateful and Stateless Bean

 
Venkatraman Prabu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to understand to difference between the stateless and stateful bean. I had created an simple application to test it. But both the beans seems to work in the same way. Could some one explain me with an example the difference between the stateful and stateless bean ...
I'm using J2EE Reference Implementation and Deploytool .
Please help me .. Urgent ....
Cheers !!!
Prabs
 
Tim Holloway
Bartender
Posts: 18417
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The effect - though not the practice of stateless session beans is that they are created, called, then destroyed. Nothing can be retained between calls. They're just collections of business methods.
Stateful session beans, on the other hand, are distinct objects - you can store something in a stateful bean on one call and retrieve it on another.
Thus, stateful session beans are like entity beans except that they don't have the extra stuff for long-term persistence - and have no unique key, so you have to track which is which yourself.
 
Phil Sharp
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are interested in using Stateful session beans you might want to look up the following reference
http://www.onjava.com/pub/a/onjava/2001/10/02/ejb.html
where Tyler Jewell discusses when they should be used and when they should not.
Also there is a long discussion on theserverside.com discussing this article.
http://www.theserverside.com/discussion/thread.jsp?thread_id=9375
Phil
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!