Say in ejbPassivate() method of a Session Bean OrderBean, I have reference to another session bean�s local home interface as an instance field, and it is not Serializable, would this cause Container to destroy OrderBean instance as instance does not meet requirements for Serialization after ejbPassivate?
NOTE: I know it's not a common case of Session Bean storing reference of another Session Bean's Home interface. Generally Session Beans interact with Entity Beans. But let's say for application requirements, we have such a scenario.
Please refer to section 7.4.1 Instance passivation and conversational state
The objects that are assigned to the instance�s non-transient fields after the ejbPassivate method completes must be one of the following: � An entity bean�s local interface reference, even if it is not serializable. � An entity bean�s local home interface reference, even if it is not serializable.
Regards,<br />Sandesh<br />(SCJCP, SCWCD, SCBCD - 99%, OCP-1)<br /> <br />Either find a way or create one.
My guess is that this would be dependent on the container implementation...the EJB spec does not illustrate how a Container should manage its pool. All required optimizations are left upto the vendor's choice. A smart container may remove the referenced bean instance during passivation but, I am not familiar if any commercial products actually do it.
Please see P.203 of HF EJB: "When ejbPassivate() completes,every non-transisent instance variable MUST be a reference to one of the following: 1. 2. 3. 4. a bean's local component or home interface, EVEN IF it's not Serializable. ....."
So your OrderBean will not be destroied while passivated.
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad: