As per the reference manual HQL accepts 'recognized SQL functions'.
When I try to use 'round' the situation appears to be as follows:
- MySQL supports round(number) and round(number, precision)
- Postgresql supports round(number) and round(number, precision) but in the latter case 'number' must not be a double. This leaves us with round(number)
- HSQLDB does not support round(number), only round(number,precision)
If an HQL query shall be DB independent 'round' appears to be unusable.
I found the following workaround:
The round function can be replaced using 'floor', e.g. for round(arg, 2) the following code can be used:
Code:
floor(abs(arg*100)+0.5)/100*sign(arg)
Any comments?
Hans