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]