B is incorrect: Passivation (serialization) skips the variables of the bean class which are declared as transient while storing the object on secondary storage.
By the completion of the ejbPassivate() method, all the nontransient fields (which will be saved) of the bean state must be one of the following:
1] A serializable object, that is, its class implements the Serializable interface. 2] Null. 3] A reference to an enterprise bean�s remote component (EJBObject) interface or remote home (EJBHome) interface. 4] A reference to an enterprise bean�s local component(EJBLocalObject) interface or local home (EJBLocalHome) interface. 5] A reference to a SessionContext object. 6] A reference to the bean�s JNDI context (for example, java:comp/env) or any of its subcontexts. 7] A reference to a user transaction interface: javax.transaction.UserTransaction. 8] A reference to a resource manager connection factory, for example, javax.sql.DataSource. 9] A reference to a javax.ejb.Timer object.
Hope this helps,
---------------------- SCJP 1.4 | SCWCD 1.4 | SCBCD 1.3 | SCEA Part I - In Progress [ May 08, 2007: Message edited by: Mahesh Desai ]
posted 13 years ago
Hi Mahesh !!
Thank you so much for your prompt response, I'll make sure to memorize the case you mentioned above.
During passivation of entity beans nothing is saved , its only put back to the pool.
In case of stateful session bean , during passivation everything that you have mentioned is saved.The only thing is that it doesnot guarantee the correct values during activation of transient variables.So you should take care of it.
Thanks Rahul for your answer, But I'm confused, I thought that for an entity bean we save the data to the underlying DB before passivating the instance entity bean, the container call ejbStore() before passivating the bean... Can some one clarify this please ?
Also the Transient field are not saved , right ?
If any comment on this and clarification, will be help me ...
Thank you all for your help,
My Regards, Rania
posted 13 years ago
Passivation , activation , ejbCreate , ejbRemove have completely different meaning for entity beans and stateful session beans.
I am talking about the objects that you have mentioned in your initial post.During passivation of stateful session beans you need to take care of transient variables during activation as because its not guaranteed that it would be set to default values.