Re: ERXExistsQualifier and compound keys in t0

Aaron Rosenzweig <[email protected]> Thu, 12 Mar 2015 22:01:59 -0400
Newsgroups gmane.comp.web.webobjects.wonder-disc
Message-ID <[email protected]>
--===============1561680650755993271==
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_0E1ED982-B5C2-4D5D-9C12-E12A8A4E640E"


--Apple-Mail=_0E1ED982-B5C2-4D5D-9C12-E12A8A4E640E
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=cp932

Hi guys,

Sorry for the late reply.

ERXExistsQualifier doesn=81ft play well with compound keys. It is a =
shortcoming.=20

In our projects we never user compound keys. Anytime we have =
many-to-many we make a simple primary key plus the additional two =
foreign keys. Invariably=81c the join table becomes something more =
important anyway.
AARON ROSENZWEIG / Chat 'n Bike
e:  [email protected]  t:  (301) 956-2319 	=09
=09

On Mar 5, 2015, at 8:30 AM, Laurence Mills-Gahl <[email protected]> =
wrote:

> Fabian,
>=20
> Thanks for the suggestion. It's been a while since I've worked with =
the houdah frameworks, but this sounds like a good idea.=20
>=20
> Larry Mills-Gahl
>=20
>> On Mar 5, 2015, at 3:32 AM, Fabian Peters <[email protected]> =
wrote:
>>=20
>> Hi Larry,
>>=20
>> It looks like you're using compound PKs. AFAIR ERExistsQualifier does =
not handle flattened relationships. I don't know about compound PKs. =
Aaron will know=81c
>>=20
>> The ExistsInRelationshipQualifier from the Houdah frameworks does =
handle flattened 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 qualifier, you'll need to include HoudahEOControl and =
HoudahEOAccess. I have disabled the custom Houdah DatabaseDelegate in =
com.houdah.eoaccess.PrincipalClass, as it caused strange behaviour =
during PK generation.
>>=20
>> Fabian
>>=20
>>> Am 05.03.2015 um 02:04 schrieb Larry Mills-Gahl <[email protected]>:
>>>=20
>>> Hello,
>>>=20
>>> I=81fm having a bit of difficulty with an ERXExistsQualifier and =
I=81fm wondering if it isn=81ft related to a compound key in the first =
table. The goal is to find unique rows in patientrole that have related =
rows in the encounter table. That=81fs a job for the Exists qualifier=81c =
(right Aaron?)
>>>=20
>>> The problem is that the last portion of the exists clause  (where =
the docs say: ...=81g and t1.FIRST_TABLE_ID =3D t0.ID)=81h is selecting =
the wrong fields to make that join.
>>>=20
>>> The two tables in question are:
>>>   patientrole (centerkey,patientkey,mrn)
>>>   encounter(centerkey, patientkey, etc=81c)
>>>=20
>>> The qualifier code is:
>>>=20
>>>       EOQualifier centerQ =3D =
DialysisTreatment.CENTERKEY.is(c.centerkey());
>>>       EOQualifier rangeQ =3D new =
ERXAndQualifier(DialysisTreatment.START_TIME.after(start),
>>>               DialysisTreatment.START_TIME.before(end));
>>>=20
>>>       EOQualifier roleQ =3D new ERXExistsQualifier(new =
ERXAndQualifier(centerQ,
>>>               rangeQ), PatientRole.DIALYSIS_TREATMENTS_KEY);
>>>=20
>>> The SQL output from this is:
>>>=20
>>> SELECT t0.centerKey, RTRIM(t0.mrn), t0.personKey=20
>>> FROM patientrole t0=20
>>> WHERE  EXISTS (=20
>>>   SELECT exists0.encounterKey=20
>>>   FROM encounter exists0=20
>>>   WHERE (exists0.centerKey =3D ?=20
>>>       AND (exists0.startTime > ? AND exists0.startTime < ?)
>>>       )=20
>>>   AND exists0.centerKey =3D t0.personKey # THIS IS THE PROBLEM LINE
>>>   )=20
>>>=20
>>> The SQL I=81fm looking for ends with :
>>>   AND exists0.centerKey =3D t0.centerKey
>>>=20
>>>=20
>>> Am I on the right track or should I accomplish this through other =
means?
>>>=20
>>>=20
>>>=20
>>> Larry Mills-Gahl
>>> [email protected]
>>>=20
>>>=20
>>>=20
>>>=20
>>>=20
>>>=20
>>> =
--------------------------------------------------------------------------=
----
>>> Dive into the World of Parallel Programming The Go Parallel Website, =
sponsored
>>> 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=20
>>> conversation now. =
http://goparallel.sourceforge.net/________________________________________=
_______
>>> Wonder-disc mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/wonder-disc
>>=20
>=20
> =
--------------------------------------------------------------------------=
----
> Dive into the World of Parallel Programming The Go Parallel Website, =
sponsored
> 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=20
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Wonder-disc mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wonder-disc


--Apple-Mail=_0E1ED982-B5C2-4D5D-9C12-E12A8A4E640E
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=cp932

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dcp932"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi =
guys,<div><br></div><div>Sorry for the late =
reply.</div><div><br></div><div>ERXExistsQualifier doesn=81ft play well =
with compound keys. It is a =
shortcoming.&nbsp;</div><div><br></div><div>In our projects we never =
user compound keys. Anytime we have many-to-many we make a simple =
primary key plus the additional two foreign keys. Invariably=81c the =
join table becomes something more important anyway.<br><div>
<table style=3D"margin-top:0.5em;margin-left:0.5em;margin-bottom:30px;" =
border=3D"0">
	<tbody><tr>
		<td colspan=3D"2" style=3D"padding-bottom: 0.3em; ">
			<span style=3D"font-family:'Trebuchet =
MS',helvetica,San-Serif;font-size:11px;color:#888888;line-height:22px"><b =
style=3D"color:#11aeab;text-transform:uppercase;letter-spacing:2px">Aaron =
Rosenzweig</b>&nbsp;/&nbsp;<a href=3D"http://www.chatnbike.com" =
title=3D"visit Chat 'n Bike" style=3D"text-decoration:none; =
border-bottom:1px dotted #888888;color:#888888">Chat 'n =
Bike</a></span><br>
			<span style=3D"font-family:'Trebuchet =
MS',helvetica,San-Serif;font-size:11px;color:#b2b2b2;"><b =
style=3D"color:#888888">e:</b>&nbsp;&nbsp;<a =
href=3D"mailto:[email protected]" title=3D"email Aaron" =
style=3D"text-decoration:none; border-bottom:1px dotted =
#b2b2b2;color:#b2b2b2">[email protected]</a>&nbsp;&nbsp;<b =
style=3D"color:#888888">t:</b>&nbsp;&nbsp;(301) 956-2319</span>
		</td>
	</tr>
	<tr>
		<td>
			<img =
src=3D"http://www.chatnbike.com/WebObjects/FamilyCycleGroupOrder.woa/Conte=
nts/WebServerResources/images/chat_n_bike_logo_small.png" alt=3D"Chat 'n =
Bike" height=3D"100">
		</td>
		<td>
			<img =
src=3D"http://www.chatnbike.com/WebObjects/FamilyCycleGroupOrder.woa/Conte=
nts/WebServerResources/images/dealers/usa.jpg" alt=3D"Chat 'n Bike" =
height=3D"100">
		</td>
	</tr>
</tbody></table>

</div>
<br><div><div>On Mar 5, 2015, at 8:30 AM, Laurence Mills-Gahl &lt;<a =
href=3D"mailto:[email protected]">[email protected]</a>&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><blockquote =
type=3D"cite">Fabian,<br><br>Thanks for the suggestion. It's been a =
while since I've worked with the houdah frameworks, but this sounds like =
a good idea. <br><br>Larry Mills-Gahl<br><br><blockquote type=3D"cite">On =
Mar 5, 2015, at 3:32 AM, Fabian Peters &lt;<a =
href=3D"mailto:[email protected]">[email protected]</a>&gt; =
wrote:<br><br>Hi Larry,<br><br>It looks like you're using compound PKs. =
AFAIR ERExistsQualifier does not handle flattened relationships. I don't =
know about compound PKs. Aaron will know=81c<br><br>The =
ExistsInRelationshipQualifier from the Houdah frameworks does handle =
flattened many-to-many relations. You may want to try it as it's very =
similar: &lt;<a =
href=3D"https://code.google.com/p/houdah-webobjects-frameworks/">https://c=
ode.google.com/p/houdah-webobjects-frameworks/</a>&gt; To use the =
qualifier, you'll need to include HoudahEOControl and HoudahEOAccess. I =
have disabled the custom Houdah DatabaseDelegate in =
com.houdah.eoaccess.PrincipalClass, as it caused strange behaviour =
during PK generation.<br><br>Fabian<br><br><blockquote type=3D"cite">Am =
05.03.2015 um 02:04 schrieb Larry Mills-Gahl &lt;<a =
href=3D"mailto:[email protected]">[email protected]</a>&gt;:<br><br>Hello,=
<br><br>I=81fm having a bit of difficulty with an ERXExistsQualifier and =
I=81fm wondering if it isn=81ft related to a compound key in the first =
table. The goal is to find unique rows in patientrole that have related =
rows in the encounter table. That=81fs a job for the Exists qualifier=81c =
(right Aaron?)<br><br>The problem is that the last portion of the exists =
clause &nbsp;(where the docs say: ...=81g and t1.FIRST_TABLE_ID =3D =
t0.ID)=81h is selecting the wrong fields to make that join.<br><br>The =
two tables in question are:<br> &nbsp;&nbsp;patientrole =
(centerkey,patientkey,mrn)<br> &nbsp;&nbsp;encounter(centerkey, =
patientkey, etc=81c)<br><br>The qualifier code is:<br><br> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EOQualifier centerQ =3D <a =
href=3D"http://DialysisTreatment.CENTERKEY.is">DialysisTreatment.CENTERKEY=
.is</a>(c.centerkey());<br> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EOQualifier rangeQ =3D new =
ERXAndQualifier(DialysisTreatment.START_TIME.after(start),<br> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;DialysisTreatment.START_TIME.before(end));<br><br> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EOQualifier roleQ =3D new =
ERXExistsQualifier(new ERXAndQualifier(centerQ,<br> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;rangeQ), PatientRole.DIALYSIS_TREATMENTS_KEY);<br><br>The SQL =
output from this is:<br><br>SELECT t0.centerKey, RTRIM(t0.mrn), =
t0.personKey <br>FROM patientrole t0 <br>WHERE &nbsp;EXISTS ( <br> =
&nbsp;&nbsp;SELECT exists0.encounterKey <br> &nbsp;&nbsp;FROM encounter =
exists0 <br> &nbsp;&nbsp;WHERE (exists0.centerKey =3D ? <br> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AND (exists0.startTime &gt; ? AND =
exists0.startTime &lt; ?)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;) <br> =
&nbsp;&nbsp;AND exists0.centerKey =3D t0.personKey # THIS IS THE PROBLEM =
LINE<br> &nbsp;&nbsp;) <br><br>The SQL I=81fm looking for ends with =
:<br> &nbsp;&nbsp;AND exists0.centerKey =3D t0.centerKey<br><br><br>Am I =
on the right track or should I accomplish this through other =
means?<br><br><br><br>Larry Mills-Gahl<br><a =
href=3D"mailto:[email protected]">[email protected]</a><br><br><br><br><br=
><br><br>-----------------------------------------------------------------=
-------------<br>Dive into the World of Parallel Programming The Go =
Parallel Website, sponsored<br>by Intel and developed in partnership =
with Slashdot Media, is your hub for all<br>things parallel software =
development, from weekly thought leadership blogs to<br>news, videos, =
case studies, tutorials and more. Take a look and join the =
<br>conversation now. =
http://goparallel.sourceforge.net/________________________________________=
_______<br>Wonder-disc mailing =
list<br>[email protected]<br>https://lists.sourceforge.net=
/lists/listinfo/wonder-disc<br></blockquote><br></blockquote><br>---------=
---------------------------------------------------------------------<br>D=
ive into the World of Parallel Programming The Go Parallel Website, =
sponsored<br>by Intel and developed in partnership with Slashdot Media, =
is your hub for all<br>things parallel software development, from weekly =
thought leadership blogs to<br>news, videos, case studies, tutorials and =
more. Take a look and join the <br>conversation now. <a =
href=3D"http://goparallel.sourceforge.net/">http://goparallel.sourceforge.=
net/</a><br>_______________________________________________<br>Wonder-disc=
 mailing list<br><a =
href=3D"mailto:[email protected]">[email protected]=
forge.net</a><br>https://lists.sourceforge.net/lists/listinfo/wonder-disc<=
br></blockquote></div><br></div></body></html>=

--Apple-Mail=_0E1ED982-B5C2-4D5D-9C12-E12A8A4E640E--


--===============1561680650755993271==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
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/
--===============1561680650755993271==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Wonder-disc mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wonder-disc

--===============1561680650755993271==--