Discussions

EJB design: The business delegate pattern example in EJBDesignPattern book

  1. Hi All,

    I was going through the code given for the business delegate pattern example in EJBDesignPattern book in Pattern Code Listing chapter.

    One point I could not understand where will the class member, namely remoteHandle, of the class ForumServicesDelegate be stored in between successive requests made by the client. The answer I can think of is to store the entire object (i.e., the instance of ForumServicesDelegate) in the session object. But in that case the session oject will really become heavy. Is there anyother solution for this ?

    In the projects I previously worked on we used to directly store the handle for a stateful session bean in the session object. The handle being just a reference it was not consuming major memory. Of course, in that case we didn't use Business Delegate pattern. So the similar issue didn't arise.

    Can anyone throw some light on this issue ?

    Regards,
    Sourav
  2. well.. sometimes i think the session delegate is actually a extra layer of code that will keep you in maintance hell. I only found it useful for JNDI lookup and better exception wrapping.

    in your case you maybe able to wrap around the session bean within the session delegate, and store this delegate object within the session object. The session delegate shouldn't store anything other than the instance of a session handle, so i bet it shouldn't take so much memory...