The specification says that transient fields are not preserved for passivation, and they are not required to be reset to their default values for activation. So, they have to be reinitialized in @PostActivate if they are to be used later. The statement you are quoting does not come explicitly from the specs, it is just common sense I would say - if you are to reinitialize the transient fields to meaningful values, you probably use some non-transient fields to help you. This is the same for serialization / deserialization, when you want transient fields to be set to anything meaningful. You could of course set it randomly, not set it at all, whatever yuo like. But, using other non-transient fields is most common.
About passivation and transient fields - the very last paragraph from section 4.2.1, pages 64 / 65:
The Bean Provider must assume that the content of transient ﬁelds may be lost between the PrePas-
sivate and PostActivate notiﬁcations. Therefore, the Bean Provider should not store in a
transient ﬁeld a reference to any of the following objects: SessionContext object; environ-
ment JNDI naming context and any its subcontexts; business interfaces; home and component inter-
faces; EntityManager interface; EntityManagerFactory interface; UserTransaction
While the container is not required to use the Serialization protocol for the Java programming language
to store the state of a passivated session instance, it must achieve the equivalent result. The one excep-
tion is that containers are not required to reset the value of transient ﬁelds during activation.
Declaring the session bean’s ﬁelds as transient is, in general, discouraged.
Hope this helps,
posted 11 years ago
thanks Raf for your reply.
Well it can be a just common sense wording's only. But not totally true.