Performance

In order to evaluate the performance of HQL queries, it is necessary to first run the HQL through the hibernate engine at run-time in order to produce the equivalent SQL. First, code the initial HQL into the application or a unit test or standalone executable program. Start the application or test program with SQL tracing turned on. When the HQL under construction executes, grab the SQL from the log/console. Then follow the directions in ??? 07 SQL Programming Standards to check the performance of the SQL.

In general, most of the advice under the SQL programming standards applies equally for coding HQL when applicable at all.