This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Hi all As I understood, a stateful session bean can maintain the client's state in its instance variable. And stateless session bean do not hold any state between invocation. Is there any particular situation where we have to declare an instance variable in a stateless session bean? Thanks -Sainudheen
Easy question for me! You can declare read-only variables. You can also declare variables, not dependent on any particular client. For example: any connection sources that can be shared between multiple clients using the same stateless session bean.
I dont agree with this. I can always update the variable.
Joined: Aug 27, 2003
Ok Pradeep, I will change my phrase. You can use read-only variables in the stateless session beans that do not get updated in the code and also variables that do get updated in the code. As long as they are not dependent on any particular client, it is fine.