Re: EOQualifier issue
Re: EOQualifier issue
- Subject: Re: EOQualifier issue
- From: "Jerry W. Walker" <email@hidden>
- Date: Tue, 21 Nov 2006 11:06:13 -0500
Hi, Fabrice,
For a given company record, the SQL logic is looking for a Person,
the Person's corresponding Employee record and the Person's
corresponding Employer record such that either the Employer's
corresponding company record or the Employee's corresponding Company
record is that given Company record.
In SQL terms, this statement:
SELECT ... FROM PERSON T0, EMPLOYEE T1, EMPLOYER T2, COMPANY T3
WHERE (T1.COMPANY_FID = ? OR T2.COMPANY_FID = ?) AND T0.ID =
T1.PERSON_FID AND T0.ID = T2.PERSON_FID
says to return a selected set of 4 records (a Person, an Employer, an
Employee and a Company) such that for a given match between either an
Employer and a Company OR an Employee and a Company, the Employer
matches the same person who is matched by the Employee.
So for a match, we have a Company matching an Employer matching a
Person matching an Employee (which may or may not match the company),
OR we have a Company matching an Employee matching a Person matching
an Employer (which may or may not match a company).
I think that's the logic you're requesting. It may not be the answer
you desire, but I think it's the answer you specified.
Regards,
Jerry
On Nov 21, 2006, at 10:10 AM, Fabrice Pipart wrote:
On Nov 21, 2006, at 3:58 PM, Daniele Corti wrote:
2006/11/21, Fabrice Pipart <email@hidden>:
Hi all !
I have been suprised by the behavior of the EOQualifier and I
wonder if it's a bug or just a misunderstanding on my part.
Let's take a simple example (mine was far too complicated to show
here) :
Let's say we have the following EO relationships :
Person <--> Employer <--> Company
Person <--> Employee <--> Company
fine, but I would prefer that you use the same name in the sql
code ...
Let's suppose I want to fetch the PERSONs that are employers and
employees in a given company
Naturally I had a qualifier like this one :
(employee.company = %@) OR (employer.company = %@)
I had troubles with this and then I activated the EOAdaptorDebug
From what I found there, EOF generates the following :
SELECT ... FROM PERSON T0, EMPLOYEE T1, EMPLOYER T2, COMPANY T3
WHERE (T1.COMPANY_FID = ? OR T2.COMPANY_FID = ?) AND T0.ID =
T1.PERSON_FID AND T0.ID = T2.PERSON_FID
What is between brackets makes sense obviously and then EOF adds
after ANDs all that is necessary to make the relationships right?
But in that case I am looking for someone that is an employer AND
an employee ???
I don't think so... T0.ID = T1.PERSON_FID and T0.ID =
T2.PERSON_FID
are just a check for consistency, I mean the system must check
that person are related with Employee and Employer. and it must be
true with AND logic...
It's a bit hard to explane in english...
I might be wrong because I hate SQL but...
I want a person to be an EMPLOYER or an EMPLOYEE, not both
(employee.company = %@) OR (employer.company = %@)
I mean if Bob is an EMPLOYEE (and not an EMPLOYER), how can it
match the requirement
T0.ID = T1.PERSON_FID and T0.ID = T2.PERSON_FID
?
In my personal problem, if I have an object that match
(employer.company = %@)
but none that matches (employee.company = %@)
If I just leave (employer.company = %@) in the qualifier I find
the object.
If I leave both I don't find it... how come?
I would have prefered to see :
WHERE (T1.COMPANY_FID = ? AND T0.ID = T1.PERSON_FID) OR
(T2.COMPANY_FID = ? AND T0.ID = T2.PERSON_FID)
Do I make a mistake ???
I think your code should work too, it would be interesting to try
it...
But, the meaning in this context is the same.
bye,
--
Daniele Corti
AIM: S0CR4TE5
Messenger: email@hidden
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@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial
Strength Internet Enabled Systems
email@hidden
203 278-4085 office
_______________________________________________
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