Agreed, a session bean is more appropriate in this scenario.  It's a
read-only transaction, so the transactional semantics associated with
an entity bean are a bit heavy-handed.

BTW, I'd recommend against the use of "select *" for potential
performance reasons.  You may indeed need all the columns today, but
this may not hold true for the life of the code, so request only the
data that's required.

Mike

--- Robert Krueger <[EMAIL PROTECTED]> wrote:
> At 13:31 08.08.00 , you wrote:
> >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 */
>
> IMHO the only way to do that is used stored procedures. how would you
>
> formulate a prepared statement with that flexibility (i.e. varying
> number
> of arguments)? I don't think you can unless you can put this stuff in
> a
> stored procedure and use that in the finder definition. So if your
> database
> supports stored procedures with array values and your JDBC driver
> handles
> the binding of the array properly, you might get away with that
> (haven't
> tried it, though). otherwise you're left with BMP or JDBC in a
> session bean.
>
> HTH,
>
> robert
> (-) Robert Krüger
> (-) SIGNAL 7 Gesellschaft für Informationstechnologie mbH
> (-) Brüder-Knauß-Str. 79 - 64285 Darmstadt,
> (-) Tel: 06151 665401, Fax: 06151 665373
> (-) [EMAIL PROTECTED], www.signal7.de
>
>
>
>
>


__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/

Reply via email to