Re: EOQualifier issue
Re: EOQualifier issue
- Subject: Re: EOQualifier issue
- From: Robert Walker <email@hidden>
- Date: Wed, 22 Nov 2006 17:29:27 -0500
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@hidden
www.freeport.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
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