Re: ERXExistsQualifier and compound keys in t0

Fabian Peters <[email protected]> Thu, 5 Mar 2015 09:32:21 +0000
Newsgroups gmane.comp.web.webobjects.wonder-disc
Message-ID <[email protected]>
Hi Larry,

It looks like you're using compound PKs. AFAIR ERExistsQualifier does not h=
andle flattened relationships. I don't know about compound PKs. Aaron will =
know=85

The ExistsInRelationshipQualifier from the Houdah frameworks does handle fl=
attened many-to-many relations. You may want to try it as it's very similar=
: <https://code.google.com/p/houdah-webobjects-frameworks/> To use the qual=
ifier, you'll need to include HoudahEOControl and HoudahEOAccess. I have di=
sabled the custom Houdah DatabaseDelegate in com.houdah.eoaccess.PrincipalC=
lass, as it caused strange behaviour during PK generation.

Fabian

Am 05.03.2015 um 02:04 schrieb Larry Mills-Gahl <[email protected]>:

> Hello,
> =

> I=92m having a bit of difficulty with an ERXExistsQualifier and I=92m won=
dering if it isn=92t related to a compound key in the first table. The goal=
 is to find unique rows in patientrole that have related rows in the encoun=
ter table. That=92s a job for the Exists qualifier=85 (right Aaron?)
> =

> The problem is that the last portion of the exists clause  (where the doc=
s say: ...=93 and t1.FIRST_TABLE_ID =3D t0.ID)=94 is selecting the wrong fi=
elds to make that join.
> =

> The two tables in question are:
> 	patientrole (centerkey,patientkey,mrn)
> 	encounter(centerkey, patientkey, etc=85)
> =

> The qualifier code is:
> =

>         EOQualifier centerQ =3D DialysisTreatment.CENTERKEY.is(c.centerke=
y());
>         EOQualifier rangeQ =3D new ERXAndQualifier(DialysisTreatment.STAR=
T_TIME.after(start),
>                 DialysisTreatment.START_TIME.before(end));
> =

>         EOQualifier roleQ =3D new ERXExistsQualifier(new ERXAndQualifier(=
centerQ,
>                 rangeQ), PatientRole.DIALYSIS_TREATMENTS_KEY);
> =

> The SQL output from this is:
> =

> SELECT t0.centerKey, RTRIM(t0.mrn), t0.personKey =

> FROM patientrole t0 =

> WHERE  EXISTS ( =

> 	SELECT exists0.encounterKey =

> 	FROM encounter exists0 =

> 	WHERE (exists0.centerKey =3D ? =

> 		AND (exists0.startTime > ? AND exists0.startTime < ?)
> 		) =

> 	AND exists0.centerKey =3D t0.personKey # THIS IS THE PROBLEM LINE
> 	) =

> =

> The SQL I=92m looking for ends with :
> 	AND exists0.centerKey =3D t0.centerKey
> =

> =

> Am I on the right track or should I accomplish this through other means?
> =

> =

> =

> Larry Mills-Gahl
> [email protected]
> =

> =

> =

> =

> =

> =

> -------------------------------------------------------------------------=
-----
> Dive into the World of Parallel Programming The Go Parallel Website, spon=
sored
> by Intel and developed in partnership with Slashdot Media, is your hub fo=
r all
> things parallel software development, from weekly thought leadership blog=
s to
> news, videos, case studies, tutorials and more. Take a look and join the =

> conversation now. http://goparallel.sourceforge.net/_____________________=
__________________________
> Wonder-disc mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wonder-disc


---------------------------------------------------------------------------=
---
Dive into the World of Parallel Programming The Go Parallel Website, sponso=
red
by Intel and developed in partnership with Slashdot Media, is your hub for =
all
things parallel software development, from weekly thought leadership blogs =
to
news, videos, case studies, tutorials and more. Take a look and join the =

conversation now. http://goparallel.sourceforge.net/