EJB design: State + Session Facade + Value Object Assembler in One EJB

  1. Can a Session Bean do all of the following

    1. Maintain Client State
    2. Act as Session Facade
    3. Act as Value Object Assembler

    If not, why?
  2. FYI it's called the facade pattern.

  3. Yes, you can absolutely do all the three.

  4. The Better approach is the code will not be scalable and may have performance issue. The Better approach is maintain the state in one class and VOA as a seperate class so the re-usability is there. Thus if another Ssession Bean method require to do operation on the same value object or do similar operation we need to have duplication of the code.