Mapping the GROUP BY clause: GroupByClauseMapper element
To map the GROUP BY clause, use the GroupByClauseMapper element in mappings.xml. The GroupByClauseMapper element has two attributes, UseSelectItemIndexes and PushComplexExprs.
UseSelectItemIndexes attribute
Most databases support expressions in the GROUP BY clause of a query, for example:
SELECT contact_last
FROM CUSTOMERS
GROUP BY city, contact_last || ', ' || contact_first
Some databases, however, do not. The SELECT clause must contain the expression and the GROUP BY clause must reference the expression by index, for example:
SELECT city, contact_last || ', ' || contact_first
FROM CUSTOMERS
GROUP BY 1, 2
If your database does not support expressions in the GROUP BY clause, set the UseSelectItemIndexes attribute to true, for example:
<GroupByClauseMapper UseSelectItemIndexes="true" />
PushComplexExprs attribute
Some databases do not support GROUP BY expressions other than column references. For such databases, a GROUP BY expression that is not a column reference should not be sent to the database. For example, GROUP BY contact_last should be sent to the database, but GROUP BY contact_last || ', ' || contact_first should not.
If your database does not support GROUP BY expressions other than column references, set the PushComplexExprs attribute to false, for example:
<GroupByClauseMapper PushComplexExprs="false" />
 
 

Additional Links:

Copyright Actuate Corporation 2012