Description
Support for DBA specific SQL Functions / Expression was added right after 3.3 was released. See org.apache.torque.utils.SummaryHelper and org.apache.torque.utils.functions package. This allows for SQL functions to be specified in queries in an SQL version independent way. E.g. string concatenation can be different on different servers.
Since SQLFunctions are created with all the same info that a Column object needs, it does not make sense to have to do:
<pre>
hoursMax = FunctionFactory.max(TimeCard.HOURS);
Column col = new ColumnImpl(
null,
TimeCard.HOURS.getTableName(),
TimeCard.HOURS.getColumnName(),
maxHours.toSQL()
);
criteria.addAsColumn(col);
</pre>
Since SQLFunctions contain the needed info for columns, the SQLFunction interface extend Column and supply the required column info via the Column functions. This means that SQLFunctions could be just added via:
criterial.addAsColumn(FunctionFactory.max(TimeCard.HOURS);