The moose likes EJB and Other Java EE Technologies and the fly likes help in Stateful and Stateless Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and Other Java EE Technologies
Reply Bookmark "help in Stateful and Stateless Bean " Watch "help in Stateful and Stateless Bean " New topic
Author

help in Stateful and Stateless Bean

Venkatraman Prabu
Greenhorn

Joined: Jul 18, 2001
Posts: 7
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
Saloon Keeper

Joined: Jun 25, 2001
Posts: 12513

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.


One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
Phil Sharp
Ranch Hand

Joined: Nov 08, 2001
Posts: 40
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
 
 
subject: help in Stateful and Stateless Bean
 
Threads others viewed
differences in detail
Session Beans
help in Stateless & Stateful Bean
Stateful and Stateless Session bean
What transaction attributes can apply to session bean methods in EJB 2.0?
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com