You can map your finder methods in the openejb-jar.xml that is created by
the deploy tool. Just grab the openejb-jar.xml file from the META-INF
directory of your jar and add a 'query' declaration like the one below for
all the CMP entities that need them.
After the deployer is run for the first time, using your favourite
editor edit openejb-jar.xml file and add your finder select statement
in openejb-jar.xml file.
Repackage your jar file.
If openejb is already running close currently running openejb instance
by telnet localhost 4200 and issuing the stop command and restart openejb.
Test your program by calling Runit.sh .
Whenever deployer is run again for your current application, it will overwrite
openejb-jar.xml file.
Say you had a home interface with the following finder method...
package org.acme.employee;
...
public interface EmployeeHome extends EJBHome{
...
public Employee findByLastName( String lastName )
throws RemoteException, FinderException;
}
|
... then that would require a 'query' declaration in your openejb-jar.xml
file like this one ...
META-INF/openejb-jar.xml |
<ejb-deployment ...
<query>
<query-method>
<method-name>findByLastName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<object-ql>
SELECT o FROM org.acme.employee.EmployeeBean o WHERE o.lastname = $1
</object-ql>
</query>
</ejb-deployment>
|
The 'query' element goes inside an 'ejb-deployment' element, right under
any 'resource-link' elements that may be there already.