Doug,
There are at least 2 ways to solve this with our default CMP engine (Note:
that we support the plugin of other cmp engines). Lets first assume for each
solution that you will pass over a JavaBean that encapsulates the possible
list of values. This JavaBean has all the fields defined in your EJB - in
your case 20. The first solution is to define a finder on the home that
takes 1 parameter - the JavaBean. Then write the following in your cmp
finder's where-clause:
(:bean.fld1 IS NULL) OR (:bean.fld1 = fld1) AND
(:bean.fld2 IS NULL) OR (:bean.fld2 = fld2) AND
.....
(:bean.fld20 IS NULL) OR (:bean.fld20 = fld10) AND
The second solution involves using a bmp and cmp finder. The bmp finder will
take the JavaBean parameter and dynamically construct a SQL statement based
on the values set. This will be executed using jdbc resulting in the
creation of an array of pks that match. To alleviate the performance hit of
this bmp finder you call the cmp finder with the pk array. Our cmp engine
engine allows you to reference an array parameter for use with the IN
operator i.e. WHERE (pk IN (:pks)). The finders loadstate flag should be set
to true.
Doug, you should post this vendor specific question to our public newsgroup.
William
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Potts, Douglas
Sent: Thursday, January 18, 2001 2:41 PM
To: [EMAIL PROTECTED]
Subject: Complex Queries in Container Managed Persistence
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
============================================================================
==
The contents of this email are confidential to the intended recipient at the
email address to which it has been addressed. It may not be disclosed to or
used by anyone other than this addressee, nor may it be copied in any way.
If received in error, please contact DLA, a UK law firm,
(http://www.dla.com/) on +44 (0) 8700 111111 quoting the name of the sender
and the addressee and then delete it from your system.
Please note that neither DLA nor the sender accepts any responsibility for
viruses and it is your responsibility to scan the email and attachments (if
any). No contracts may be concluded on behalf of DLA by means of email
communications.
A list of the names of the partners of DLA (who are either solicitors or
registered foreign lawyers) and their qualifications is available for
inspection at 3 Noble Street, London, EC2V 7EE, UK.
Regulated by the Law Society of England and Wales; authorised by the Society
to conduct investment business.
============================================================================
==
===========================================================================
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".