While Passivatating a Stateful Bean does The container(Say we are using Weblogic8.1) saves the beans conversataional state or do we have to programatically (every time ) and if we can, how do we do it ? Please could some one throw some light on it
Ususally the passivation is done by serializaing the statefull bean on the disk or database. So there is no need make a special mechanism in order to support passivation/ectivation, except the java serialization constraints.
Best regards, Mircea
The answer is not that straight forward. We need to look at what do u mean by the conversational state. If u mean the class variables , the Serialization rules for java objects pretty much applies to passivation and activation of stateful session beans. The methods ejbPassivate() and ejbActivate()'s serves to notify the bean that it is going to be swapped out of memory. Anything a POJO should do when it is serialized (e.g free up JDBC resources , etc) should be done in ejbPassivate(). In ejbActivate() , the bean can try to build up its state again (e.g getting JDBC connection again , etc)
If u mean the conversational state as the connection between the client and the bean , there is nothing that we need to do to maintain the connection. It is the application server's responsibility.