Doubt related to SFSB made ready for Serialization
posted 9 months ago
I am studying the specification and I am having some doubts hope someone could help me out with these.
1) According to the specification the SFSB and its Interceptor instances should be ready for serialization after the PrePassivate() method callback. How can the bean developer make the SFSB interceptor's instance variables ready for passivation like to make references to non serializable data null? Should the interceptor also have a PrePassivate method or would the interceptor's AroundInvoke method be called before the PrePassivate method? I thought Interceptor classes do not hold a conversational state so why is it required for SFSB's to have specific instances of the Interceptor and the interceptor is serialized together with the SFSB?
2) In the spec it says that the SFSB is ready for passivation even it contains references to the following as the serialization of those should be handled by the session bean container.
•A reference to a container-managed EntityManager object, even if it is not serializable.
•A reference to an EntityManagerFactory object obtained via injection or JNDI lookup, even if it is not serializable.
but it also says that if a bean is using extended persistence context and the container can passivate the bean only if
•All the entities in the persistence context are serializable.
•The EntityManager is serializable.
so its like if only the bean is using extended persistence the EntityManager should be serializable for the container to passivate the bean? and it also says that the container cannot destroy the bean if it doesnt comply to the above mentioned condition so in that case such beans are not destroyed and would exist without being passivated?