what is the difference between stateless and stateful
sessions?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are transaction isolation levels in ejb?

549


What is stateless session bean?

556


Define Initial Context?

588


Why do we need ejb?

575


Define SessionContext ?

593






Which services are provided to ejb components by the ejb container?

731


How can enterprise javabeans be accessed from active server pages?

569


Name the acid properties of a transaction.

550


Enlist the declarative transaction types?

602


What is ejb javatpoint?

572


What is the difference between find and select methods in ejb?

541


What are the various types of entrepreneur java bean?

525


Define ACID Properties?

600


Which is the only method defined in the javax.ejb.handle interface?

633


What is the use of @ejb annotation?

538