Discussions

EJB programming & troubleshooting: Finder methods in EJB

  1. Finder methods in EJB (2 messages)

    Hi
     Im new in EJB
     I would like to know how to declare finder methods in a container managed persistent bean.
     IM suing ejb2.0 and ive defined a findAll() method. how to declare that in the ejb-jar.xml.
     Please help me because this is urgent. Where can i find more info abt this. I searched for this and noone gives example for findAll() methods.

    Regards
    Sanjay

    Threaded Messages (2)

  2. Finder methods in EJB[ Go to top ]

    The finder methods in CMP, are written when you write the bean class, in the home interface.

    U dont have to define these methods in the ejb-jar.xml file.

    only the find method in the home interface and corresponding create method in the bean class needs to be written ( as u know there would be a create method for each of the finder methods).

    Write your findAll method in the home and then the ejbCreate method (ofcourse the arguments would be same).

    When you call this method .. (normal create method ).. this will refer to the findAll method, which will communicate to the ejbCreate method.

    thanks
  3. Finder methods in EJB[ Go to top ]

    Hi
     You need to add the following lines in the ejb-jar.xml file
      
               <query>
                  <query-method>
                    <method-name>findAll</method-name>
    <method-params>
                    </method-params>
                  </query-method>
                  <ejb-ql>
                    <![CDATA[FROM EJBBeanName AS a]]>
                  </ejb-ql>
                </query>

    we are using the above format in weblogic6.0 , ejb2.0 specs with ejb query language.it's working.if ur using the ejb2.0 specs with ejb query language... try be using the above format..