posted 23 years ago
Hi,
Stateful session beans maintain conversational state when used by client.
Conversational state means, the beans state is kept in memory while a client uses a session (but it is not written to a database though).
Maintaining conversational state allows a client to carry on a conversation with a bean. As each method on a bean is invoked, the state of the session bean may change, and the change can affect subsequent method calls. So for the subsequent method calls the client will get the updated state of the bean.
Conversational state is kept for as long as the client application is actively using the bean. Once the client shuts down or releases the bean, the convesational state is lost forever.
Stateful session beans are not shared among clients, but they r dedicated to the same client for the life of the bean.
On the other hand stateless session bean do not maintain any conversational state. Each method is completely independent and uses only data passed in its parameters.
So stateless session beans r shared among the clients and a single bean instance can serve multiple clients.
Hope u get cleared to some extent.. for detailed explanation with example, refer Enterprise JavaBeans by oreilly publications..
Saran
Saran
Sun Certified Java2 Programmer