Hi ! ,
First of all , let me explain the motivation behind statefullsession bean.
statefullsession beans are used to maintain the conversational state of the client. This means they are attached to a particular client and saves information about him, so that client need not resend the information about him , during each business method invokation.
But for the performance optimization , your bean container (vendor dependent) may use the technique called Instance pooling. In instance pooling , the container creates a set of bean instances and reuse them to service the client request. But the instance pooling is transparent to the client.
Now the question is how the container does this.
For the container to achieve this it uses callback methods namely ejbActivate() and ejbPassivate() method.
Container calls ejbPassivate() method just before serializing your bean object to some persistent store so that it can be activated again when the client corressponding to this bean object sends request.
By calling ejbPassivate() container giives you a chance to close the resources that can not be serialized.
Now , when the client corressponding to above bean
calls any method , the container first of all deserializes the bean (hence it's state is restored), then it calls bean's ejbActivate() method.
again, by calling ejbActivate() container gives you a chane to open the resources that you need in your business methods.
Hope this will help you in redesigning your business logic.