Discussions

EJB design: Critical highlevel ejb design problem

  1. Critical highlevel ejb design problem (3 messages)

    Hello Friends,
                   I have a critical problem the problemgoes like this-I have a servlet which looks up an session ejb.In this session ejb an object is created which is not serializable.After this object is created i have to pass it other session bean.Remember this object that is created is not serializable.I have tried this using weblogic server where the session bean returns a object to the servlet and the servlet looks up another session bean and sets this object.it works fine.But when i try with orion server it is giving objectNot Serializable exception which is very reasonable.Can any ejb experts suggest me how do i overcome this problem(or is it not at all possible to transport a non serializable object??).I need to transport an object from one ejb to another ejb through a servlet and the object is not serializable.I have one solution which i think is a round about way.
    thanks in advance
    venkat
  2. The easiest way is to use EJB 2.0 and local interfaces - if that's an option.
    Local interfaces are specified to use non-serializable objects as parameters.
  3. Hi, in case you don't use EJB 2.0 you can also utilize Value Objects (a.k.a. Data Transfer Objects) to pass your data between tiers and/or between EJBs. Your value object will implement java.io.Serializable. This website has great articles related to the Value Object pattern.
  4. You could create a subclass of the object and have the subclass implement serializable. Then just pass the subclassed object.

    HTH, Tom