Re: Using distinct in to-many relationship?
Re: Using distinct in to-many relationship?
- Subject: Re: Using distinct in to-many relationship?
- From: Marcos Trejo Munguia <email@hidden>
- Date: Mon, 21 Aug 2006 18:21:43 -0500
Actually I,m using the EOFetchSpecification constructor that pass that
parameter:
public EOFetchSpecification(String entityName,
EOQualifier qualifier,
NSArray sortOrderings,
boolean usesDistinct,
boolean isDeep,
NSDictionary hints)
I,m passing true in usesDistinct, I suppose that it have the same
effect as setUsesDistinct(true). The problem is not with the main
entity but with the relationships passed in
setPrefetchingRelationshipKeyPaths, more specifically with to-many
relationships.
On Aug 21, 2006, at 1:41 PM, Zak Burke wrote:
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