2 Replies Latest reply on Nov 18, 2002 10:55 PM by Eric Chow

    ejbSelect and findBy method

    Eric Chow Newbie

      Hello,


      Would you please to tell me when should use ejbSelect and findBy in EJB ?


      Best regards,
      Eric

        • 1. Re: ejbSelect and findBy method
          Adrian Brock Master

          ejbFindBy returns primary key(s) of the
          entity bean. It is the implementation of findBy
          in the home interface and can be used by clients
          to obtain bean proxies. The container turns the
          primary keys into remote/local interface implementations.

          e.g.

          MyRemote bean = home.findByNickName("eric138");

          ejbSelect can return any type of bean
          (not necessarily the same entity where it is defined)
          or cmp-field. The entity uses it internally.

          e.g.

          Collection emails = bean.getEmails(Date date);

          // Get the user's e-mails for a date
          public Collection getEmails(Date date)
          {
          return ejbSelectEmails(date);
          }

          Regards,
          Adrian