Hi Craig, thanks you for sending this out. I was very busy this week and forgot to send the email.
Regards Michael > Last week we discussed navigating through references and specifically the > following: > > SELECT this from Employee where manager.manager == null > > This translates to: > > SELECT DISTINCT > A0.BIRTHDATE,A0.FIRSTNAME,A0.LASTNAME,A0.PERSONID,A0.HIREDATE,A0.WEEKLYHOURS,A0.DISCRIMINATOR > FROM APPLICATIONIDENTITY0.PERSONS A0 > LEFT OUTER JOIN APPLICATIONIDENTITY0.PERSONS B0 ON A0.MANAGER = B0.PERSONID > WHERE ((A0.DISCRIMINATOR = 'org.apache.jdo.tck.pc.company.FullTimeEmployee’ > OR A0.DISCRIMINATOR = > 'org.apache.jdo.tck.pc.company.PartTimeEmployee')) > AND B0.MANAGER IS NULL > > Navigation through a null-valued field, which would throw > NullPointerException, is treated as if the subexpression returnedfalse. > Similarly, a failed cast operation, which would throw ClassCastException, is > treated as if the subexpression returned false. Other subexpressions or > [other values for variables might still qualify the candidate instance for > inclusion in the result set.] > > The above SQL does not implement this JDOQL specification. > > The problem is that the WHERE condition B0.MANAGER IS NULL it true for two > distinct cases: > > o B0 is null > o B0 is not null and B0.manager is null > > In order for the B0.manager == null to return only cases where B0 is not null > and B0.manager is null, the SQL would have to do one of these: > > o include AND A0.MANAGER IS NOT NULL > o use INNER JOIN APPLICATIONIDENTITY0.PERSONS B0 ON A0.MANAGER = B0.PERSONID > > It is not clear to me that LEFT OUTER JOIN is appropriate here. > > Craig L Russell > Architect > [email protected] > P.S <mailto:[email protected]>. A good JDO? O, Gasp! > > -- Michael Bouschen akquinet tech@spree GmbH Bülowstraße 66 • D-10783 Berlin Tel: +49 30 235520-33 Fax: +49 30 217520-12 E-Mail: [email protected] <mailto:[email protected]> Web: www.akquinet.de <http://www.akquinet.de/> Geschäftsführung: Martin Weber, Dr. Torsten Fink Amtsgericht Berlin HRB 86780 • USt.-Id. Nr.: DE 225 964 680 [Facebook] <http://www.facebook.com/akquinet> [XING] <https://www.xing.com/companies/akquinetag> [G+] <https://plus.google.com/b/111054946250796705170/+akquinet/posts> [LinkedIn] <https://www.linkedin.com/company/akquinet-ag> [Twitter] <https://twitter.com/akquinet>
