To map the GROUP BY clause, use the GroupByClauseMapper element in mappings.xml. The GroupByClauseMapper element has two attributes, UseSelectItemIndexes and PushComplexExprs.
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:
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.