New HSQLDB has a support for Oracel compatibility by:
SET DATABASE SQL SYNTAX ORA TRUE
So, the HSQLDB knows ROWNUM. However, I cannot use it in @Formula. Please, add ROWNUM into the HSQLDialect in the same way, as it is in the Oracle9iDialect. E.g. add:
// Oracle compatibility mode support - SET DATABASE SQL SYNTAX ORA TRUE
registerFunction( "rownum", new NoArgSQLFunction("rownum", Hibernate.LONG, false) );
Patch adds support for ROWNUM() in all modes when used with HSQLDB 2.2.x and above. Please check.