what is the difference between stateless and stateful
sessions?

Answers were Sorted based on User's Feedback



what is the difference between stateless and stateful sessions?..

Answer / john doe

In the above answer the second paragraph there is a typo. It
is the Stateful Session Bean whcih maintain the conversation
state between Client and Server

Is This Answer Correct ?    33 Yes 6 No

what is the difference between stateless and stateful sessions?..

Answer / rajshekaran pillai

In case of a Stateful session bean a state called passive
state exists in its life cycle. The EJB container uses a
lease recently used algorithm to decide to passivate the
bean i.e move it from memory to secondary storage. Whenever
the client calls any business method on the bean it is
activated.
Whereas a stateless session bean is never passivated

Is This Answer Correct ?    8 Yes 1 No

what is the difference between stateless and stateful sessions?..

Answer / sathish babu

stateless sessinobean:can not maintain the state,cannot
maintain the persistance(data base),onece sutdown
machine,we cannot see that data,cannot have the
passivate,activate states.ex:atm mini statements.

statefull sessionbean:maintain the state,but cannot
maintain the persistance,once we sutdown the system the
values stored in local hard disc,can have the passivate and
activate states.ex:shopping card

Is This Answer Correct ?    8 Yes 3 No

what is the difference between stateless and stateful sessions?..

Answer / amar

1.when we use stateless, we look up the bean, call a method,
we give up the bean reference, the bean return to pool;
2.when we use stateful, we look up the bean and keep the
reference for a long time(may several minutes to hours, say
shopping cart), we call methods sometime. if we use
stateless, each client will always associated one bean in
memory, it costs a lot! for stateful, we don't need to worry
about it too much, the container will passivate some of them
to disk when resource is not enough. I think it is the real
benefit of stateful session bean.

Is This Answer Correct ?    4 Yes 1 No

what is the difference between stateless and stateful sessions?..

Answer / dhawal

stateless session bean can not gives responce to each
request of server content can maintain persistancewhile
statefull session bean can give responce to each request of
server content but can not maintain persistance

Is This Answer Correct ?    4 Yes 1 No

what is the difference between stateless and stateful sessions?..

Answer / eshwar sharaf

A Stateful Session Bean is a bean that is designed to service business processes that span multiple method requests or transactions. Stateful Session beans retain state on behalf of an individual client. Stateless Session Beans do not maintain state.
EJB containers pools stateless session beans and reuses them to service many clients. Stateful session beans can be passivated and reused for other clients. But this involves I/O bottlenecks. Because a stateful session bean caches client conversation in memory, a bean failure may result in loosing the entire client conversation. Therefore, while writing a stateful session bean the bean developer has to keep the bean failure and client conversation loss in mind.
In case of stateless session beans, client specific data has to be pushed to the bean for each method invocation which will result in increase in the network traffic. This can be avoided in a number of ways like persisting the client specific data in database or in JNDI. But this also results in I/O performance bottlenecks.
If the business process spans multiple invocations thereby requiring a conversation then stateful session bean will be the ideal choice. On the other hand, if business process lasts only for a single method call, stateless session bean model suits.

Stateful session beans remembers the previous request and responses. But stateless beans do not. stateful does not have pooling concept, whereas the stateless bean instances are pooled.

Is This Answer Correct ?    4 Yes 1 No

what is the difference between stateless and stateful sessions?..

Answer / anitha

after deploying Stateless bean, Ejb Container creates some
objects and palce it in Object pooling.for each client
request it will get any one object from pool and serve the
client.so that it con't able to store client specific data
while invoking methods.

Where as in Statefull Bean, for each client the Container
creates one Object and serve the Client each request until
client exit.so that it can able to Persist the Client
data.it supports Object Activation and Passivation

Is This Answer Correct ?    3 Yes 2 No

what is the difference between stateless and stateful sessions?..

Answer / buddheshwar ojha

BY rahul ojha
A stateful session bean maintains state between client and the statefulbean for a duration of time and once state is end it end session completely it also maintains data persistency(database).(Shoping card etc...)

A stateless session bean does not maintain conversation state for a longer time Instance variables used by a method of a stateless bean may have a state, but only for the duration of the method invocation. After a method has finished running either successfully or unsuccessfully, the states of all its instance variables are dropped.(HTTP , telephone line conversation etc...).

Is This Answer Correct ?    1 Yes 0 No

what is the difference between stateless and stateful sessions?..

Answer / harish

Stateless session Bean will not maintain the conversation
state between the requests. Each request will be
independent. It does not support Activation and
Passivation.
Where as Stateless Session Bean, it maintains the
conversation state between Client and Server. Each
request, it can hold the data. It supports Activation and
Passivation

Is This Answer Correct ?    16 Yes 21 No

what is the difference between stateless and stateful sessions?..

Answer / bindehswar jha

Stateless Session bean support activation and Passivation
By passivation the bean isntance go to the instance pool
when it is not fulfilling any request and by activation the
bean instance active and fullfill the anohter request.

Is This Answer Correct ?    4 Yes 16 No

Post New Answer

More EJB Interview Questions

Is is possible for an ejb client to marshal an object of class java.lang.class to an ejb?

0 Answers  


What is ejb and how it works?

0 Answers  


how to deploy enterprise javabeans?

2 Answers   Inforica,


The ejb container implements the ejbhome and ejbobject classes. For every request from a unique client, does the container create a separate instance of the generated ejbhome and ejbobject classes?

0 Answers  


What are transaction isolation levels in ejb?

0 Answers  






What is the difference between ejb and spring?

0 Answers  


how can u integrate ejb and hibernate? How can u call hibernateDAO methods in session bean?

0 Answers   Infosys,


Name the attributes of javax.ejb.stateful.

0 Answers  


What are the callback annotations for entity bean?

0 Answers  


What are the components of session beam?

0 Answers  


What do you mean by abstract schema?

0 Answers  


what is mean by RMI ? Please answer me. Advance thanks.

3 Answers   Excel,


Categories