Re: Query returning denormalised view

2003-02-25 Thread Ron Gallagher
John -- 

Use this constructor when you create your query object:

QueryByCriteria(Class,Criteria,boolean)

Passing true for the 3rd argument causes the generated sql to include the DISTINCT 
keyword.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

> 
> From: O'Reilly John <[EMAIL PROTECTED]>
> Date: 2003/02/25 Tue PM 01:20:25 EST
> To: 'OJB Users List' <[EMAIL PROTECTED]>
> Subject: Query returning denormalised view
> 
> Hi,
> 
> I'm having a problem whereby a query that involves searching for values in a
> contained collection returns the same number of objects as the collection.
> Take, for example the case of a member object that has a collection of
> addresses.  If I do the following query.
> 
> crit.addLike("upper(name)", "%John Smith%" );
> crit.addLike("upper(addresses.addressLine1)", "%1 High Street%" ); //
> addressModel
> 
> Query query = new QueryByCriteria(MemberModel.class, crit);
> listOfMembers = getBroker().getCollectionByQuery(query);
> 
> The returned collection has as many objects as there are addresses (in my
> test case, I have a number of addresses (all the same) linked to the same
> member).  There should only be one member object which in turn contains a
> collection of addresses.
> 
> BTW, I'm using version 0.9.9 with the addition of the patch mentioned below:
> http://www.mail-archive.com/[EMAIL PROTECTED]/msg00447.html
> 
> The problem happens without the patch also.
> 
> Regards,
> John



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Query returning denormalised view

2003-02-25 Thread O'Reilly John
Hi,

I'm having a problem whereby a query that involves searching for values in a
contained collection returns the same number of objects as the collection.
Take, for example the case of a member object that has a collection of
addresses.  If I do the following query.

crit.addLike("upper(name)", "%John Smith%" );
crit.addLike("upper(addresses.addressLine1)", "%1 High Street%" ); //
addressModel

Query query = new QueryByCriteria(MemberModel.class, crit);
listOfMembers = getBroker().getCollectionByQuery(query);

The returned collection has as many objects as there are addresses (in my
test case, I have a number of addresses (all the same) linked to the same
member).  There should only be one member object which in turn contains a
collection of addresses.

BTW, I'm using version 0.9.9 with the addition of the patch mentioned below:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg00447.html

The problem happens without the patch also.

Regards,
John

This e-mail and any files transmitted with it are confidential and may be
privileged and are intended solely for the individual named/ for the use of
the individual or entity to whom they are addressed.If you are not the
intended addressee, you should not disseminate, distribute or copy this
e-mail.Please notify the sender immediately if you have received this e-mail
by mistake and delete this e-mail from your system.If you are not the
intended recipient, you are notified that reviewing, disclosing, copying,
distributing or taking any action in reliance on the contents of this e-mail
is strictly prohibited.Please note that any views or opinions expressed in
this e-mail are solely those of the author and do not necessarily represent
those of Traventec Limited.E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted, lost,
destroyed, or arrive late or incomplete.Traventec Limited therefore does not
accept liability for any errors or omissions in the contents of this
message, which arise as a result of e-mail transmission.The recipient should
check this e-mail and any attachments for the presence of viruses.This
e-mail has been swept for computer viruses however Traventec Limited accepts
no liability for any damage caused by any virus transmitted by this e-mail.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]