Re: ERXExistsQualifier and compound keys in t0

Aaron Rosenzweig <[email protected]> Mon, 30 Mar 2015 19:31:51 -0400
Newsgroups gmane.comp.web.webobjects.wonder-disc
Message-ID <[email protected]>
--===============8305968292367466489==
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_16234718-DB83-484E-A3A4-BC57B660F1E3"


--Apple-Mail=_16234718-DB83-484E-A3A4-BC57B660F1E3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=cp932

Hi Larry,

Yes I=81fll be there :-)=20
AARON ROSENZWEIG / Chat 'n Bike
e:  [email protected]  t:  (301) 956-2319 	=09
=09

On Mar 29, 2015, at 11:33 PM, Larry Mills-Gahl <[email protected]> =
wrote:

> Aaron,
>=20
> Thanks for the clarification (and apologize for missing this in my =
in-box, I=81fm just cleaning up the backlog now)
>=20
> Are you going to be in Hamburg for WOWODC? I hope to see you there.=20
>=20
>=20
> Larry Mills-Gahl
> [email protected]
>=20
>=20
>=20
>=20
>=20
>=20
>> On Mar 12, 2015, at 10:01 PM, Aaron Rosenzweig <[email protected]> =
wrote:
>>=20
>> Hi guys,
>>=20
>> Sorry for the late reply.
>>=20
>> ERXExistsQualifier doesn=81ft play well with compound keys. It is a =
shortcoming.=20
>>=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
>>=20
>> On Mar 5, 2015, at 8:30 AM, Laurence Mills-Gahl <[email protected]> =
wrote:
>>=20
>>> 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
>>=20
>=20


--Apple-Mail=_16234718-DB83-484E-A3A4-BC57B660F1E3
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 =
Larry,<div><br></div><div>Yes I=81fll be there :-)&nbsp;<br><div><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 style=3D""><div>On Mar 29, 2015, at 11:33 PM, Larry 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"><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dcp932"><div style=3D"word-wrap: break-word; -webkit-nbsp-mode: =
space; -webkit-line-break: after-white-space;" class=3D""><div =
class=3D"">Aaron,</div><div class=3D""><br class=3D""></div><div =
class=3D"">Thanks for the clarification (and apologize for missing this =
in my in-box, I=81fm just cleaning up the backlog now)</div><div =
class=3D""><br class=3D""></div><div class=3D"">Are you going to be in =
Hamburg for WOWODC? I hope to see you there.&nbsp;</div><div =
class=3D""><br class=3D""></div><br class=3D""><div =
apple-content-edited=3D"true" class=3D"">
<div style=3D"font-family: Helvetica; font-style: normal; font-variant: =
normal; font-weight: normal; letter-spacing: normal; line-height: =
normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; =
text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" =
class=3D""><div style=3D"font-family: Helvetica; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; =
line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: =
0px; text-transform: none; white-space: normal; widows: 2; word-spacing: =
0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" =
class=3D""><div class=3D"">Larry Mills-Gahl</div><div class=3D""><a =
href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a></div><div class=3D""><br =
class=3D""></div><div class=3D""><br class=3D""></div></div><br =
class=3D"Apple-interchange-newline"></div><br =
class=3D"Apple-interchange-newline"><br =
class=3D"Apple-interchange-newline">
</div>
<br class=3D""><div><blockquote type=3D"cite" class=3D""><div =
class=3D"">On Mar 12, 2015, at 10:01 PM, Aaron Rosenzweig &lt;<a =
href=3D"mailto:[email protected]" class=3D"">[email protected]</a>&gt;=
 wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><meta=
 http-equiv=3D"Content-Type" content=3D"text/html charset=3Dcp932" =
class=3D""><div style=3D"word-wrap: break-word; -webkit-nbsp-mode: =
space; -webkit-line-break: after-white-space;" class=3D"">Hi guys,<div =
class=3D""><br class=3D""></div><div class=3D"">Sorry for the late =
reply.</div><div class=3D""><br class=3D""></div><div =
class=3D"">ERXExistsQualifier doesn=81ft play well with compound keys. =
It is a shortcoming.&nbsp;</div><div class=3D""><br class=3D""></div><div =
class=3D"">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 class=3D""><div class=3D"">
<table style=3D"margin-top:0.5em;margin-left:0.5em;margin-bottom:30px;" =
border=3D"0" class=3D"">
	<tbody class=3D""><tr class=3D"">
		<td colspan=3D"2" style=3D"padding-bottom: 0.3em; " =
class=3D"">
			<span style=3D"font-family:'Trebuchet =
MS',helvetica,San-Serif;font-size:11px;color:#888888;line-height:22px" =
class=3D""><b =
style=3D"color:#11aeab;text-transform:uppercase;letter-spacing:2px" =
class=3D"">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" class=3D"">Chat 'n Bike</a></span><br class=3D"">
			<span style=3D"font-family:'Trebuchet =
MS',helvetica,San-Serif;font-size:11px;color:#b2b2b2;" class=3D""><b =
style=3D"color:#888888" class=3D"">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" class=3D"">[email protected]</a>&nbsp;&nbsp;<b =
style=3D"color:#888888" class=3D"">t:</b>&nbsp;&nbsp;(301) =
956-2319</span>
		</td>
	</tr>
	<tr class=3D"">
		<td class=3D"">
			<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" class=3D"">
		</td>
		<td class=3D"">
			<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" class=3D"">
		</td>
	</tr>
</tbody></table>

</div>
<br class=3D""><div class=3D""><div class=3D"">On Mar 5, 2015, at 8:30 =
AM, Laurence Mills-Gahl &lt;<a href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a>&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><blockquote type=3D"cite" =
class=3D"">Fabian,<br class=3D""><br class=3D"">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 class=3D""><br =
class=3D"">Larry Mills-Gahl<br class=3D""><br class=3D""><blockquote =
type=3D"cite" class=3D"">On Mar 5, 2015, at 3:32 AM, Fabian Peters =
&lt;<a href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a>&gt; wrote:<br class=3D""><br =
class=3D"">Hi Larry,<br class=3D""><br class=3D"">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 =
class=3D""><br class=3D"">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/" =
class=3D"">https://code.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 class=3D""><br class=3D"">Fabian<br =
class=3D""><br class=3D""><blockquote type=3D"cite" class=3D"">Am =
05.03.2015 um 02:04 schrieb Larry Mills-Gahl &lt;<a =
href=3D"mailto:[email protected]" class=3D"">[email protected]</a>&gt;:<br=
 class=3D""><br class=3D"">Hello,<br class=3D""><br class=3D"">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 class=3D""><br class=3D"">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 class=3D""><br class=3D"">The two tables in question =
are:<br class=3D""> &nbsp;&nbsp;patientrole =
(centerkey,patientkey,mrn)<br class=3D""> =
&nbsp;&nbsp;encounter(centerkey, patientkey, etc=81c)<br class=3D""><br =
class=3D"">The qualifier code is:<br class=3D""><br class=3D""> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EOQualifier centerQ =3D <a =
href=3D"http://dialysistreatment.centerkey.is/" =
class=3D"">DialysisTreatment.CENTERKEY.is</a>(c.centerkey());<br =
class=3D""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EOQualifier rangeQ =3D =
new ERXAndQualifier(DialysisTreatment.START_TIME.after(start),<br =
class=3D""> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;DialysisTreatment.START_TIME.before(end));<br class=3D""><br =
class=3D""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EOQualifier roleQ =3D =
new ERXExistsQualifier(new ERXAndQualifier(centerQ,<br class=3D""> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;rangeQ), PatientRole.DIALYSIS_TREATMENTS_KEY);<br class=3D""><br=
 class=3D"">The SQL output from this is:<br class=3D""><br =
class=3D"">SELECT t0.centerKey, RTRIM(t0.mrn), t0.personKey <br =
class=3D"">FROM patientrole t0 <br class=3D"">WHERE &nbsp;EXISTS ( <br =
class=3D""> &nbsp;&nbsp;SELECT exists0.encounterKey <br class=3D""> =
&nbsp;&nbsp;FROM encounter exists0 <br class=3D""> &nbsp;&nbsp;WHERE =
(exists0.centerKey =3D ? <br class=3D""> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AND (exists0.startTime &gt; ? AND =
exists0.startTime &lt; ?)<br class=3D""> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;) <br class=3D""> &nbsp;&nbsp;AND =
exists0.centerKey =3D t0.personKey # THIS IS THE PROBLEM LINE<br =
class=3D""> &nbsp;&nbsp;) <br class=3D""><br class=3D"">The SQL I=81fm =
looking for ends with :<br class=3D""> &nbsp;&nbsp;AND exists0.centerKey =
=3D t0.centerKey<br class=3D""><br class=3D""><br class=3D"">Am I on the =
right track or should I accomplish this through other means?<br =
class=3D""><br class=3D""><br class=3D""><br class=3D"">Larry =
Mills-Gahl<br class=3D""><a href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a><br class=3D""><br class=3D""><br =
class=3D""><br class=3D""><br class=3D""><br class=3D""><br =
class=3D"">---------------------------------------------------------------=
---------------<br class=3D"">Dive into the World of Parallel =
Programming The Go Parallel Website, sponsored<br class=3D"">by Intel =
and developed in partnership with Slashdot Media, is your hub for all<br =
class=3D"">things parallel software development, from weekly thought =
leadership blogs to<br class=3D"">news, videos, case studies, tutorials =
and more. Take a look and join the <br class=3D"">conversation now. <a =
href=3D"http://goparallel.sourceforge.net/________________________________=
_______________" =
class=3D"">http://goparallel.sourceforge.net/_____________________________=
__________________</a><br class=3D"">Wonder-disc mailing list<br =
class=3D""><a href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a><br class=3D""><a =
href=3D"https://lists.sourceforge.net/lists/listinfo/wonder-disc">https://=
lists.sourceforge.net/lists/listinfo/wonder-disc</a><br =
class=3D""></blockquote><br class=3D""></blockquote><br =
class=3D"">---------------------------------------------------------------=
---------------<br class=3D"">Dive into the World of Parallel =
Programming The Go Parallel Website, sponsored<br class=3D"">by Intel =
and developed in partnership with Slashdot Media, is your hub for all<br =
class=3D"">things parallel software development, from weekly thought =
leadership blogs to<br class=3D"">news, videos, case studies, tutorials =
and more. Take a look and join the <br class=3D"">conversation now. <a =
href=3D"http://goparallel.sourceforge.net/" =
class=3D"">http://goparallel.sourceforge.net/</a><br =
class=3D"">_______________________________________________<br =
class=3D"">Wonder-disc mailing list<br class=3D""><a =
href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a><br class=3D""><a =
href=3D"https://lists.sourceforge.net/lists/listinfo/wonder-disc" =
class=3D"">https://lists.sourceforge.net/lists/listinfo/wonder-disc</a><br=
 class=3D""></blockquote></div><br =
class=3D""></div></div></div></blockquote></div><br =
class=3D""></div></blockquote></div><br></div></div></body></html>=

--Apple-Mail=_16234718-DB83-484E-A3A4-BC57B660F1E3--


--===============8305968292367466489==
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/
--===============8305968292367466489==
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

--===============8305968292367466489==--