2 Replies Latest reply on Feb 8, 2005 5:12 PM by Keyur Shah

    state replication of non-serializable fields

    Keyur Shah Newbie

      I have a clustered stateful session bean... I have a field in this bean bean which is of a non-serialzable type (say, NonSer)... I also have another class (a DTO / VO) which is a serialzable representation of NonSer (say NonSerDTO)... When the bean passivates, I have the opportunity to convert the NonSer field to its NonSerDTO and rehydrate the same in ejbActivate... However, in case of state replication across cluster nodes, I am not aware of any callback methods which give me the opportunity to do that...

      I'll appreciate your thoughts on how I could achieve state replication in this case.

      Below is the gist of the code to clarify my problem:

      public class MySFSB implements MyInterface {
       transient NonSer nonSer; //non-serializable field
       NonSerDTO ser; //serializable representation of nonSer
       //The ser field is null except between passivate and activate
       public void ejbPassivate {
       ser = converttoDTO(nonSer);
       nonSer = null;
       public void ejbActivate {
       nonSer = convertFromDTO(ser);
       ser = null;