cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hugi Thordarson <>
Subject Modifying join syntax generated by Cayenne's EJBQL
Date Thu, 25 Feb 2016 12:56:40 GMT
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.year
= t1.year)

While this works:
…FROM bok_invoice_line t0 INNER JOIN bok_invoice t1 ON ( = 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()

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?

- hugi
View raw message