Solution: Do two fetches.
And use EOKeyValueQualifier and EOOrQualifier, thats cleaner and faster.

Or an alternative would be to do a raw row fetch and specify exactly how you want to perform the fetch, and then promote the rows to full EOs as you need.

EOF has a SQL generator that has decided to first create all the joins for all the tables, then append your qualifier to the result. I typically resort to raw SQL whenever I need to perform fetches that are more complex than EOF can handle. It's pretty easy to write better SQL than EOF, when it comes to select efficiency anyway. This is especially true when multiple table joins are involved.

In other words EOF sees your relationships, and first creates the join syntax. Any additional qualification beyond that will get appended using an "AND."

In this particular case it is possible that two separate fetches, performing simple joins, may be faster than a single select containing multiple table joins. Only testing would reveal if this is true.

On Nov 22, 2006, at 4: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.

Solution: Do two fetches.
And use EOKeyValueQualifier and EOOrQualifier, thats cleaner and faster.

good luck,
        atze


Freeport & Soliversum
Alexander Spohr
[EMAIL PROTECTED]
www.freeport.de


_______________________________________________
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/robertwalker1% 40mac.com

This email sent to [EMAIL PROTECTED]

_______________________________________________
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]

Reply via email to