2 Replies Latest reply on Aug 7, 2003 5:59 AM by rohitvadera

    Very Simple Question

    rohitvadera

      To which class does create() and ejbCreate() methods belong.
      I m finding them in documentation.Not in interfaces
      EnterpriseBean
      EJBHome
      EJBObject
      SessionBean
      EntityBean
      Found remove() and ejbRemove() but confirm for it also
      Thanx

        • 1. Re: Very Simple Question
          edelarosa

          hi rohitvadera,

          as per ejb 1.1/2.0 specifications:

          1. create()

          - this method must be declared in your home interface that
          extends the EJBHome interface
          - return value must be your EJB remote object

          2. ejbCreate()

          - this method must be declared in your bean class that
          implements either SessionBean and EntityBean, depends
          on what type of EJB you have.
          - each create() in your home must have a
          corresponding ejbCreate() in your bean class -
          with same number of signatures or arguments

          Explanation:
          You cannot find the create() and ejbCreate() because
          they are not part of any interfaces that you mentioned. But
          they are part of the specification. The specification says
          that these methods must appear in your home and bean class
          because the (a) EJB Container calls them when they
          are instantiated and pooled and (b) the Client calls them
          explicitly through the home.create() method in order to
          acquire an instance of your EJB.

          3. remove() & ejbRemove()

          - this method (both defined in EJBHome and EJBObject) is
          called by the Container (or can be explicitly called by the
          client) to remove an entity or session. if you intend to remove
          your EJB explicitly and programmatically, you declare one
          in your remote interface.
          - calling the remove() method through your remote object will
          trigger the container to execute the corresponding
          ejbRemove() in your bean class so you make sure that you
          have some cleanup codes in this method to release all
          the resources that you used during the lifetime of your bean.

          i hope this helps.

          • 2. Re: Very Simple Question
            rohitvadera

            Thanx

            edelarosa