In your Home.java:
public Collection findByPublishable ( String str ) ;
This should create the same SQL.
Look in orion/application-deployments/your-app/orion-ejb-jar.xml after you
deploy it.
Use it like this:
Collection c = findByPublishable("Yes");
Iterator iter = c.iterator();
while ( iter.hasNext() ) {
Question question = ( Question ) iter.next();
}
> -----Original Message-----
> From: Jeremy Cowgar [SMTP:[EMAIL PROTECTED]]
> Sent: August 8, 2000 1:31 PM
> To: Orion-Interest
> Subject: FindBy method
>
> Greetings,
>
> I would like to create a Q&A type program to track FAQ's and their
> answers.
> Now my question comes in as to how to/or even if, a container managed bean
> can handle a FindBy method that would require a SQL statement that would
> change... For instance, the user could type in:
>
> JAVA EJB ORION
>
> and it would find anything that contains JAVA and EJB and ORION in a
> Keywords or Question field.
>
> The way I would do it in code (maybe it's all wrong) is:
>
> String sSQL = "SELECT * FROM Questions WHERE Publishable = 'Yes' "
>
> for (int i = 0; i <= array.length; i++ ) {
> sSQL += "AND Keyword LIKE '%" + array[i] + "%' ";
> }
>
> /* execute my query */
>
> ---
>
> how does that translate into a FindBy method?
>
> Thanks!
>
> Jeremy - [EMAIL PROTECTED]
> Christian Brotherhood Newsletter
>