prefetching key paths problem

Laurence Mills-Gahl <[email protected]> Sun, 7 Feb 2016 21:46:44 -0500
Newsgroups gmane.comp.web.webobjects.wonder-disc
Message-ID <[email protected]>
--===============9025700641266177606==
Content-Type: multipart/signed;
	boundary="Apple-Mail=_FB4B1697-C2FA-4DF2-AB6E-CE576CD9F356";
	protocol="application/pgp-signature"; micalg=pgp-sha256


--Apple-Mail=_FB4B1697-C2FA-4DF2-AB6E-CE576CD9F356
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_5064A09B-CB54-403E-B75A-18C54F8072E7"


--Apple-Mail=_5064A09B-CB54-403E-B75A-18C54F8072E7
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Hello,

I am running into a problem with prefetching that appears to be related =
to a derived column.

The model is Treatments with to-many Alerts (treatment.alerts)
Treatments has a derived column with the YEARWEEK which is used mostly =
for post fetch grouping. I also use it to fetch ranges of data (weeks)

The problem is that when I set prefetchKeyPaths to NSArray(=E2=80=9Calerts=
), I get sql generated that puts the derived column in the alerts =
instead of the treatments.
Here is the SQL

SELECT t0.e1, t0.e2, t0.e3, t0.threshold, t0.tripletDate,
RTRIM(t0.triplettype), t0.tripletKey FROM triplet t0,
encounter T1 WHERE ((t0.triplettype =3D ? OR t0.triplettype =3D ?)
AND (YEARWEEK(t0.startTime,1) =3D ? AND T1.centerKey =3D ?))
AND t0.e3 =3D T1.encounterKey
withBindings: 1:"a"(tripletType), 2:"v"(tripletType), =
3:201604(weekOfYear), 4:10296(centerkey)


YEARWEEK(t0.startTime,1) =3D ? is the problem. It should be YEARWEEK(t1, =
startTime,1)

If the qualifier uses  startTime between two times, the same thing =
happens. The same thing happens if I use a fetch spec instead of =
ERXEOControlUtilities so Im thinking this is likely a MySQL Plugin =
issue. I did some poking around the alias creation in

My next step is to turn to raw fetches with SQL, but I thought I=E2=80=99d=
 ask if anybody else has seen this and has any advice.


Larry Mills-Gahl
[email protected]







--Apple-Mail=_5064A09B-CB54-403E-B75A-18C54F8072E7
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" =
class=3D""><div class=3D"">Hello,</div><div class=3D""><br =
class=3D""></div><div class=3D"">I am running into a problem with =
prefetching that appears to be related to a derived column.</div><div =
class=3D""><br class=3D""></div><div class=3D"">The model is Treatments =
with to-many Alerts (treatment.alerts)</div><div class=3D"">Treatments =
has a derived column with the YEARWEEK which is used mostly for post =
fetch grouping. I also use it to fetch ranges of data (weeks)</div><div =
class=3D""><br class=3D""></div><div class=3D"">The problem is that when =
I set prefetchKeyPaths to NSArray(=E2=80=9Calerts), I get sql generated =
that puts the derived column in the alerts instead of the =
treatments.</div><div class=3D"">Here is the SQL</div><div class=3D""><br =
class=3D""></div><div class=3D""><div class=3D"">SELECT t0.e1, t0.e2, =
t0.e3, t0.threshold, t0.tripletDate,&nbsp;</div><div =
class=3D"">RTRIM(t0.triplettype), t0.tripletKey FROM triplet =
t0,&nbsp;</div><div class=3D"">encounter T1 WHERE ((t0.triplettype =3D ? =
OR t0.triplettype =3D ?)&nbsp;</div><div class=3D""><b class=3D"">AND =
(YEARWEEK(t0.startTime,1)</b> =3D ? AND T1.centerKey =3D =
?))&nbsp;</div><div class=3D"">AND t0.e3 =3D T1.encounterKey</div><div =
class=3D"">withBindings: 1:"a"(tripletType), 2:"v"(tripletType), =
3:201604(weekOfYear), 4:10296(centerkey)</div></div><div class=3D""><br =
class=3D""></div><div class=3D""><br class=3D""></div><div =
class=3D"">YEARWEEK(t0.startTime,1) =3D ? is the problem. It should be =
YEARWEEK(<b class=3D"">t1</b>, startTime,1)</div><div class=3D""><br =
class=3D""></div><div class=3D"">If the qualifier uses &nbsp;startTime =
between two times, the same thing happens. The same thing happens if I =
use a fetch spec instead of ERXEOControlUtilities so Im thinking this is =
likely a MySQL Plugin issue. I did some poking around the alias creation =
in&nbsp;</div><div class=3D""><br class=3D""></div><div class=3D"">My =
next step is to turn to raw fetches with SQL, but I thought I=E2=80=99d =
ask if anybody else has seen this and has any advice.</div><div =
class=3D""><br class=3D""></div><br class=3D""><div class=3D"">
<div style=3D"color: rgb(0, 0, 0); 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-size-adjust: auto; =
-webkit-text-stroke-width: 0px; word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; " =
class=3D""><div style=3D"color: rgb(0, 0, 0); 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-size-adjust: auto; =
-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""></body></html>=

--Apple-Mail=_5064A09B-CB54-403E-B75A-18C54F8072E7--

--Apple-Mail=_FB4B1697-C2FA-4DF2-AB6E-CE576CD9F356
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQEcBAEBCAAGBQJWuAGUAAoJEH6+KDQxPmwvosMIAIVjhyVXIYuWgjFrIqbUPjtp
nA/j4m1ZtfmWj/6KDpAwyI41xkbn+S20pXc+icZ1GbthuX7BCi5tyv3WuY0E70Yo
0lyagXeIjYqNd0Za99EaVWwjKkoWiIg2umDd9kokpQYIuzC7g67pfDOWGMa0LoUJ
9lxyXI6bS6/8XPPuFqO8po69FoGQ/pU0NPZ1REztbTf6zpXlAaGRcVHTSypuEooN
91flnrLl5E5gqrYWb4lf3KKy4NL7bq2ortJnJNsEmu/En4CktAJFg7gXsiWWs1dg
o/wX9I2JZ0PcGrtEPHSqAl36rMFExPmt8/rDIZ6AKab+uHc2rjSXCF8cfkiN0kM=
=IM2f
-----END PGP SIGNATURE-----

--Apple-Mail=_FB4B1697-C2FA-4DF2-AB6E-CE576CD9F356--


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

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
--===============9025700641266177606==
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

--===============9025700641266177606==--