1 Reply Latest reply on Jan 9, 2006 11:51 AM by sewatech

    Stateless Session Bean and EJBObject.remove method

    rameshsr

      I have a stateless session bean. Inside this bean, I have multiple ejb methods that the client app can invoke. The client invokes my ejb methods by doing a
      i) JNDI lookup of the EJB
      ii) EJBHome.create
      iii) invoke the ejb method on the remote
      The client does not call the EJBObject.remove() method explicitely. I have a couple of questions:

      1) Should my client explicitely call the EJBObject.remove() method as a (iv)th step above.

      2) Can my client do the steps (i) and (ii) above once in the initialize() part of my client class and use the remote object through out the class instead of doing all the above 3 steps everytime?

      It is not very clear from looking at the EJB 2.0 spec to me.

        • 1. Re: Stateless Session Bean and EJBObject.remove method
          sewatech

          You should call the EJBObject.remove() method, even if it has no effect on a stateless bean.

          It is recommanded to do the steps (i) only once. In fact the HomeFactory pattern will explain how to manage it. The step (ii) can also be done once with stateless beans. In fact, 2 consecutive calls on the same client side object can be executed by 2 differents server side beans.