1 Reply Latest reply on Oct 16, 2003 8:11 AM by vashistvishal

    Custome finder method in JBOSS 3.2.2

    ranaaich

      Hi All,

      I have a basic question regarding writing the custom finder method and deploying it on JBOSS 3.2.2.

      Can we write a custom finder method findByXXXX where XXXX is one of the primary keys in the underlying DB table? Will it return me the correct set of rows? In my case I'm getting same row repeatedly.

      Regards and thanks in advance.

      Rana Aich

        • 1. Re: Custome finder method in JBOSS 3.2.2

          You can write a finder methods in to ways for a primary key.

          Single-Object Finder Methods
          ----------------------------------
          In Home interface:
          Account findByPrimaryKey(AccountPK pk)

          In Bean.
          public AccountPK ejbFindByPrimaryKey (AccountPK pk)


          Multiple -Object Finder Methods
          ------------------------------------
          In bean
          public java.uiti.lCollection ejbFindByPrimary Key(AccountPK pk)

          Ejb Spec 10.5.2 and 10.5.6
          -------------------------------

          Also
          From Ejb specs 10.5.6
          -------------------------
          An entity bean s home interface defines one or more finder methods[20], one for each way to find an entity object or collection of entity objects within the home. The name of each finder method starts with the prefix find , such as findLargeAccounts. The arguments of a finder method are
          used in the implementation of the query for the finder method to locate the requested entity objects. Every finder method except findByPrimaryKey(key) must be associated with a query element in the deployment descriptor. The entity Bean Provider declaratively specifies the EJB QL finder query and associates it with the finder method in the deployment descriptor. A finder method is normally characterized by an EJB QL query string specified in the query element.


          Also have a look at
          http://www.tusc.com.au/tutorial/html/chap6.html


          I hope all this helps,
          Vishal