I am confused with the transient variable or non-transient(e.g. serializable object) variable different after passivation. Transient variable value will lose but non-transient variable value will be kept in activation?
Is it true we don't need to do anything (in ejbPassivated() method)? If it is wrong, what should we do in ejbPassivated() and ejbActivate() for those transient and non-transient varialbes.
If an instance variable is NOT serializable, assign null in ejbPassivate() and re-initialize it back in ejbActivate(). If an instance variable is Serializable, you need not do anything in ejbPassivate() and ejbActivate(). The container guarantees proper restoration on activation.
Transient variables are generally considered sensitive and are not preferred to be written to secondary storage. The container ignores them during passivation. They may not be restored back also, even if they are Serializable. So what does a transient variable contain after ejbActivate() is run? It may be null or may even be a garbage! [ March 02, 2005: Message edited by: Keerthi P ]
SCJP, SCWCD, SCBCD, OCA J8
Trust God, but always tether your camel... to this tiny ad.
Devious Experiments for a Truly Passive Greenhouse!