• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Differentiate stateless and stateful

 
Naren Chivukula
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Alex Sharkoff
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Naren Chivukula
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic