Ok, here's how I understand it - Magnus et al feel free to correct ;)

from orion-ejb-jar.xml (the Orion deployment file for one / more EJBs)

>  <finder-method>
this tag defines a finder method your entity bean has in it's home
interface. It is autogenerated by Orion but can be customised for you. No
matter what your finder method is called or what arguments it takes, Orion
always generates the equivalent of a 'findAll()' and you're left to
customise it's behaviour yourself.

>     <!-- Generated SQL: "SELECT id, subject, text, date, submitter, locale
> FROM com_evermind_ejb_NewsItem WHERE subject LIKE ? OR text LIKE ?" -->
this shows you the custom SQL that orion is performing to return the find
method results - useful for debugging.

>     <query>$subject LIKE $1 OR $text LIKE $1</query>
this is text appended to the SQL query "SELECT ... FROM ... WHERE". The
$subject and $text are references to CMP fields (usually directly above in
the orion-ejb-jar file). Orion will substitute the correct persistence name
if you put the correct EJB field name. The $1, $2 etc are the parameters
passed to your method in order ($1 being the first parameter, $2 the second
etc). Orion handles all SQL escaping (I think?)

NOTE if you want to order data you can put it in here to, at the moment it
requires a slight workaround because of the WHERE ending. (eg
<query>$subject = $subject ORDER BY $subject DESC</query>) This will be
changed in future versions (I believe?)

>     <method>
>      <method-name>findByContent</method-name>
The name of the find method (generated for you from your home interface).

>      <method-params>
>       <method-param>java.lang.String</method-param>
These are the types of the parameters passed to the method in order from top
to bottom. Top will be $1 in the <query> tag.

>      </method-params>
>     </method>
>    </finder-method>
Closing tags.

Hope this helps! (and is mostly correct!)

Cheers,
Mike
 __
|  | Director - The BookmarkBox P/L
|  |  http://www.bookmarkbox.com <http://www.bookmarkbox.com/>
|/\| Manage and share your bookmarks online!

Do you enjoy our service? Why not tell your friends about us?
http://www.bookmarkbox.com/email.cfm


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Frank Apap
> Sent: Thursday, 9 December 1999 12:44
> To: Orion-Interest
> Subject: Question about <finder-method>
>
>
> Could someone go through the tags of the example below and explain how it
> works...  thanks
>
>
>  <finder-method>
>     <!-- Generated SQL: "SELECT id, subject, text, date, submitter, locale
> FROM com_evermind_ejb_NewsItem WHERE subject LIKE ? OR text LIKE ?" -->
>     <query>$subject LIKE $1 OR $text LIKE $1</query>
>     <method>
>      <method-name>findByContent</method-name>
>      <method-params>
>       <method-param>java.lang.String</method-param>
>      </method-params>
>     </method>
>    </finder-method>
>
> Its most;ly the query line im curious about?
>
>
>

Reply via email to