Giri,
<vendor>
With IAS, if you have the following finder method:
Collection findByStuff(String a1, String a2, String a3, String a4, String a5) ...;
And if these five arguments need to match five columns called
c1, c2, c3, c4, c5, then you would define your finder method as
follows:
<finder>
<method-signature>
findByStuff(String a1, String a2, String a3, String a4, String a5)
</method-signature>
<where-clause>
(:a1 is null or :a1 = c1) and
(:a2 is null or :a2 = c2) and
(:a3 is null or :a3 = c3) and
(:a4 is null or :a4 = c4) and
(:a5 is null or :a5 = c5)
</where-clause>
<load-state>True</load-state>
</finder>
What you are doing is saying: search for the non null attributes that
match the correspnding columns. If you wanted to search by attribute
a1, you would call:
home.findByStuff(a1, null, null, null, null);
if you wanted to search by a1, a3, and a5, you would call:
home.findByStuff(a1, null, a3, null, a5);
Hopefully you get the idea.
Although the syntax differs for other AppServer, I would expect that
the same can be done. (And just for fun, I challenge anyone to write
that where clause in WebLogic's LISP/XML hybrid syntax correctly by
hand ;-)
</vendor>
-jkw
> Hi folks,
>
> I am trying to write a search Servlet. This
> Servlet will delegate the search criteria to an Entity
> bean and get the results.
>
> Now I have 5 searchable fields.User can select
> one or more fields to fill in the search criteria. If
> I used bean managed persistence then I can write a
> simple method which returns an enumeration and use it
> everywhere calling the same method. This method will
> dynamically create the SQL statement and gets me back
> the results.
>
> Now the question is how do we do the same thing
> in Container managed persistence.One way is to specify
> finder methods for all the permutations and
> combinations. Then is doable, but I want to write a
> single method to do the job. I appreciate your reply.
> thanks in advance.
>
> Giri
>
> __________________________________________________
> Do You Yahoo!?
> Get Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".