Douglas,
I think the easiest way to do this is using a finder method that can take
null parameters. So, if I want to query on a string and an integer, I would
have following finder:
public interface FooHome ... {
public Collection findByStuff(String s, Integer i) ...;
}
Then I would define the where clause as:
((:s is null) or (:s = s)) and ((:i is null) or (:i = i))
That is, return all values for which either :s is null, or :s has the same
value as the column s, and where :i is null, or :i has the same value as
the column i.
If you don't like using Integer, but prefer int, then you need to select a
default numeric value.
<vendor>
See the example:
<appserver>/examples/ejb/instructors
which illustrates this technique for the method:
InstructorHome.findByAddress(Address a)
</vendor>
-jkw
"Potts, Douglas" wrote:
>
> Hi,
> We're doing some entity beans using CMP. One of the tables as about twenty
> fields. The requirement is to be able to search on any combination of those
> fields. Does this mean we have to do a finder for each of the possibilities
> or s there another way of doing it.
> We're using Inprise Application Server on Win NT4 with EJB 1.1
> Regards and thanks,
> Doug
===========================================================================
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".