File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Fundamental doubt in SLB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Fundamental doubt in SLB" Watch "Fundamental doubt in SLB" New topic
Author

Fundamental doubt in SLB

Nijeesh Balan
Ranch Hand

Joined: Oct 09, 2000
Posts: 116
Hi,
I have a fundamental doubt in Stateless Session Beans. If i have instance variables in Stateless Session Beans will it behave like a stateful session bean inspite of mentioning session bean type as Stateless in the xml file.
Plz clarify.
Thanks in Advance,
Nijeesh.


Thanks & Regards,<br />Nijeesh.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Yes, u can maintain the state using stateless session bean if the container returns u the same instance every time u access, which cannot be assumed ...


Originally posted by Nijeesh BH:
Hi,
I have a fundamental doubt in Stateless Session Beans. If i have instance variables in Stateless Session Beans will it behave like a stateful session bean inspite of mentioning session bean type as Stateless in the xml file.
Plz clarify.
Thanks in Advance,
Nijeesh.


Groovy
Nandu Arni
Greenhorn

Joined: Jan 26, 2002
Posts: 8
Why should we use instances variables inside a stateless session bean. If we use, how can we initialize. if you initialize thru create method..it will be a statefull.
Incase of stateless session bean, the connection is set for every method call irrespective of the client accessing the bean.
So it all depends on the vendor implenting the container, conceputually it sould not store the state of the instance variables between the method calls.
but incase if weblogic and websphere, the state of the instance variables defined inside a stateless bean are still maintained.
The idea od SLSB is not to use instance variables.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Fundamental doubt in SLB