Hello Jonas,
Jonas Larsson wrote:
> How do I create a custom finder method in a CPM EJB with Orionserver? Is
> that possible yet?
> Example:
> Collection findByName( String Name ) /* Returns all ejb:s where NAME=Name */
Yes, it is possible. This is how you do it:
1. Define the finder in the Home class, for example public Collection
findByName(String name) throws RemoteException, FinderException;
2. Deploy the ejb (starting the server). A orion/orion-ejb-jar.xml file gets
created.
3. Edit the orion-ejb-jar.xml file, find the <finder-method> definition. Enter
the query between <query> and </query>. This query corresponds to the where
field in a SELECT query but with bean variables having the prefix $ and method
parameters having the syntax $<parameternumber>. An example would be:
<query>$name = $1</query>
This would mean the variable name (in the bean) would be matched against the
first parameter (name). All beans matching this will be returned in a
Collection.
4. Touch the ejb-jar.xml file
5. Start the server again. The bean will get redeployed.
Karl Avedal
The Orion team