*
The moose likes EJB and other Java EE Technologies and the fly likes Differentiate stateless and stateful Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Differentiate stateless and stateful" Watch "Differentiate stateless and stateful" New topic
Author

Differentiate stateless and stateful

Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 576

Hi,

Is a bean called stateless if it has single method? Is this criteria in determining a bean stateless or stateful? Can we find from a program whether the bean used stateless or stateful? Please clarify my doubts.

Thanks and regards,
Narendranath.


Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
Naren,

Stateless sb - a session bean that does not maintain a conversational state with the client (i.e. same bean instance can be used by different clients)

Stateful sb - a session bean that maintains a conversational state with the client (i.e. bean instance will only service a client who created it)

Looks like you want to read "Head First EJB"

Hope it helps.


Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 576

Hi,

Before I went through your reply I have already read the topics thorougly. Anyhow I thank u for sending reply. Can u list out some sites which have stateful session bean examples and entity bean examples. I tried for them but in vain.

Thanking you,
Narendranath.
Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
Originally posted by Naren Chivukula:
Hi,

Is a bean called stateless if it has single method? Is this criteria in determining a bean stateless or stateful? Can we find from a program whether the bean used stateless or stateful? Please clarify my doubts.

Thanks and regards,
Narendranath.


1. Stateful session bean maintains the Beans state in between the method invocations.
2.Choosing the type of session bean is not about the number of methods present in the bean.

Consider that the bean present with only one method. Client wants to call the same method again and again and he wants to maintain the state between the method invocation then in that case you have to go for stateful session bean. Otherwise you can go for stateless session bean as Stateless will be faster than Stateful session bean.

Regards,
M.S.Raman
 
wood burning stoves
 
subject: Differentiate stateless and stateful
 
Similar Threads
Stateless session bean and transaction question
Stateless Bean Calling Stateful Bean
What is Multiple Deployment of an EJB?
How to persist a Stateless Session Bean over several jsp pages?
Sessions