EJBQL translation goes through a phase of creating a SQLTemplate, which is 
essentially SQL with embedded Velocity directives. Then SQLTemplate is executed 
against the DB. All this happens inside EJBQLAction [1]. So perhaps you can 
copy some of this code and put it in your unit test and analyze SQLTemplate 
contents? 

The only "context" you will need is DataNode. It is available via injection 
inside any test that inherits from ServerCase:

@Inject
protected DataNode node;

Andrus

[1] 
https://github.com/apache/cayenne/blob/master/cayenne-server/src/main/java/org/apache/cayenne/access/jdbc/EJBQLAction.java


> On Aug 16, 2016, at 6:36 PM, Hugi Thordarson <[email protected]> wrote:
> 
> Hi all,
> since I want to try to do a little work on EJBQL in Cayenne; is there any way 
> for me to generate and look at the SQL that will be generated by an 
> EJBQLQuery without actually submitting it to the DB?
> 
> Cheers,
> - hugi
> 
> // Hugi Thordarson
> // http://www.loftfar.is/
> // s. 895-6688
> 
> 
> 

Reply via email to