cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Modifying join syntax generated by Cayenne's EJBQL
Date Fri, 26 Feb 2016 07:19:17 GMT
> if I use the same expression with a regular SelectQuery, Cayenne puts “AND” between
the joins rather than commas and everything works fine.

So this means AND works on other DBs and we should simply align Select transaltor with EJBQL
translator. Maybe let's create a pull request for that and we'll do the testing across DBs?

Andrus


> On Feb 25, 2016, at 3:56 PM, Hugi Thordarson <hugi@karlmenn.is> wrote:
> 
> Hi all.
> 
> When Cayenne generates SQL for EJBQLQueries that use relationships with multiple joins,
it puts commas between the joins in the resulting SQL-statement. This does not work with Informix
(that I’m unfortunately currently using), instead it wants “AND” between the joins.
Incidentally, if I use the same expression with a regular SelectQuery, Cayenne puts “AND”
between the joins rather than commas and everything works fine.
> 
> For example, this doesn’t work: 
> …FROM bok_invoice_line t0 INNER JOIN bok_invoice t1 ON (t0.company = t1.company, t0.year
= t1.year)
> 
> While this works:
> …FROM bok_invoice_line t0 INNER JOIN bok_invoice t1 ON (t0.company = t1.company AND
t0.year = t1.year)
> 
> I see that the generation of the join expression (and insertion of the comma) happens
in EJBQLJoinAppender.generateJoiningExpression(), but creating a DB-specific EJBQLJoinAppender
seems like a lot of work, since the class relies on some private APIs (like EJBQLTableId,
EJBQLTranslationContext.makeEntityQualifierMarker() etc…).
> 
> Does anyone have any suggestions on how I can hook into the SQL-generation process to
replace that comma with an “AND" without resorting to duplicating somewhat large parts of
the EJBQL SQL translation logic?
> 
> Cheers,
> - hugi


Mime
View raw message