Re: Using distinct in to-many relationship?
Re: Using distinct in to-many relationship?
- Subject: Re: Using distinct in to-many relationship?
- From: Zak Burke <email@hidden>
- Date: Mon, 21 Aug 2006 14:41:00 -0400
Marcos Trejo Munguia wrote on 8/21/06 2:17 PM:
> Recently I found that the SQL generated by a fetch using
> setPrefetchingRelationshipKeyPaths with a to-many relationship generates
> the query without distinct while for to-one relationships uses distinct.
Call setUsesDistinct(true) on your fetch-spec.
I just discovered this too. It was the source of some very mysterious
seeming behaviour -- extra copies of EOs would show up in lists with
(seemingly) no explanation.
>From the javadoc:
public void setUsesDistinct(boolean usesDistinct)
Sets whether duplicate objects or records are removed after
fetching. If flag is true they are removed (that is, proper sets
are returned). If flag is false they aren't (multisets are
returned). EOFetchSpecifications by default don't use distinct.
zak.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden