On Nov 22, 2006, at 10:49 AM, Alexander Spohr wrote:
Am 22.11.2006 um 09:39 schrieb Fabrice Pipart:
Is it me that asked for that in the Qualifier or that's a mistake
of EOF ?
It's EOF’s mistake.
EOF makes sure that you get your persons. So it needs to join them
with the employee and the employer tables. Therefore the AND. It
has no notion that you wanted to different joins - and those
connected by OR.
You are right. This is what you want:
(T1.COMPANY_FID = ? AND T0.ID = T1.PERSON_FID) OR (T2.COMPANY_FID
= ? AND T0.ID = T2.PERSON_FID)
But EOF can not create that for you, as it tries to qualify one
result set, that fits the given qualifier. You want two result-sets
in one select statement.
Ah !
Good to hear !
I was wondering if I was mad or that bad in SQL ;-)
Solution: Do two fetches.
I can do that, now that I know there is no mistake on my side.
Something like :
EOQualifier qual = new EOKeyValueQualifier("employer.company",
EOQualifier.QualifierOperatorEqual, playlist);
EOSortOrdering nameOrdering =
EOSortOrdering.sortOrderingWithKey("name",
EOSortOrdering.CompareAscending);
NSMutableArray ordering = new NSMutableArray();
ordering.addObject(nameOrdering);
EOFetchSpecification fs = new EOFetchSpecification("Media",
qual, ordering, true, false, null);
NSArray mediaList = ec.objectsWithFetchSpecification(fs);
EOQualifier qual = new EOKeyValueQualifier("employee.company",
EOQualifier.QualifierOperatorEqual, playlist);
EOSortOrdering nameOrdering =
EOSortOrdering.sortOrderingWithKey("name",
EOSortOrdering.CompareAscending);
NSMutableArray ordering = new NSMutableArray();
ordering.addObject(nameOrdering);
EOFetchSpecification fs = new EOFetchSpecification("Person",
qual, ordering, true, false, null);
NSArray mediaList = ec.objectsWithFetchSpecification(fs);
And use EOKeyValueQualifier and EOOrQualifier, thats cleaner and
faster.
.... what do you mean there ?
Ok I can create EOOrQualifier filter = new EOOrQualifier(new NSArray
(new Object[] { employerFilter, employeeFilter }));
But then, how can that help me ?
I suppose you're talking about in memory operations but I can't see
how to do this...
Please note that I need distincts objects because some will be common
between the two fetches
I am absolutely sorry if the question is stupid :-(
Fabrice
good luck,
atze
Freeport & Soliversum
Alexander Spohr
[EMAIL PROTECTED]
www.freeport.de
www.easyshadow.com
International Corporate Consulting
Palais de la Scala
1 avenue Henri Dunant
Suite 1155
MC - 98000 Monaco
Skype: fabrice.pipart
Tel. +377 97 98 21 04 (direct)
Fax. +377 97 70 88 07
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]