• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Regarding Session Beans!!

 
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Folks,
The difference between Stateless and Stateful Session Beans is,in the latter the state is maintained between method invocations by defining instance variables in the bean implementation class.If i define the instance variables in the stateless session beans...will the state be maintained?In the Stateful Session Beans,how do the container maintains the state.Please clarify my doubts?
Regards,
Ravi
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

If i define the instance variables in the stateless session beans...will the state be maintained?

The most important thing is that you can't count on the state being maintained. It might, it might not. It depends on the EJB Container's implementation.
For example, in the following series of two method invocations to the same stateless session bean reference you can't rely on the two method calls being processed by the same bean instance (even though the reference is the same):
MySLSB slsb = home.create();
slsb.doSomething("This is the first call");
slsb.doSomething("This is the second call");

In the Stateful Session Beans,how do the container maintains the state.


Once again, depends on the EJB Container implementation. It might read the state from the bean using reflection and write it to disk, or it might serialize the whole bean instance to disk.
 
I guess I've been abducted by space aliens. So unprofessional. They tried to probe me with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic