> *SELECT *t.orderNumber, *SUM*(*COALESCE*(t.column1, t.column2)) *FROM *table
> t *GROUP BY* t.orderNumber;
> 
> But that's not possible in EJBQL, right?

Not to my knowledge. So SQLTemplate (or 3.2/4.0 SQLSelect) is probably needed 
here.

> Is there a way to extend the EJBQL?

Not easily.

> Also, is there a grammar available of the EJBQL?


Looks like it is missing from the docs, but it is available in Git:

https://github.com/apache/cayenne/blob/master/cayenne-server/src/main/jjtree/org/apache/cayenne/ejbql/EJBQLParser.jjt

Andrus

> On Nov 7, 2014, at 8:31 PM, Mark Stobbe <[email protected]> wrote:
> 
> Thanks everyone for your help with the multi-user stuff!!
> 
> I managed to implement a hybrid system where individual totals are
> calculated in the getXXX method and whenever multiple totals are requested
> at once (e.g. in a table) then it loads them with an EJBQL query.
> 
> Now I just have to figure out to make a total by summing either column 1 if
> set, and otherwise column 2, in SQL:
> 
> *SELECT *t.orderNumber, *SUM*(*COALESCE*(t.column1, t.column2)) *FROM *table
> t *GROUP BY* t.orderNumber;
> 
> But that's not possible in EJBQL, right? Is there a way to extend the
> EJBQL? Also, is there a grammar available of the EJBQL?
> 
> Mark

Reply via email to