On Friday 22 Jan 2016 19:25:24 Andy Jefferson wrote:
> > > SELECT p.*, t.* FROM Person p
> > > LEFT JOIN PersonTemplate pt ON p.id = pt.personId
> > > LEFT JOIN Template t ON pt.templateId = t.id
> > >
> > > With this query, I can get Persons even if they don't have a Template.
> > Which is what you would do if you followed the example I suggested, using 
> > JDOQL variables.
> > 
> > SELECT p, t FROM mydomain.Person WHERE pt.person == this && pt.t == t
> > VARIABLES mydomain.PersonTemplate pt, mydomain.Template t
> 
> That should be
> 
> SELECT p, t FROM mydomain.Person WHERE pt.person == this && pt.template == t
> VARIABLES mydomain.PersonTemplate pt, mydomain.Template t


Duh, and fixing the Person alias also that should be

SELECT this, t FROM mydomain.Person WHERE pt.person == this && pt.template == t
VARIABLES mydomain.PersonTemplate pt, mydomain.Template t


but then its simple if you just try it.


-- 
Andy
DataNucleus (Web: http://www.datanucleus.org   Twitter: @datanucleus)

Reply via email to