Quick Assessment of Hibernate Efficiency

Out of curiosity, I ran a test to compare the speed at which Hibernate completes executing HQL vs SQL vs Criteria selections.

The results are pretty clear. Running the selection a thousand times:
HQL Query executed in 1764 ms
SQL Query executed in 486 ms
Criteria executed in 683 ms

The results were similar for other total executions. HQL took the longest, and Criterias executed in about half the time. SQL queries were the fastest, running about a quarter of the time of an HQL query.

Running a single execution:
HQL Query executed in 115 ms
SQL Query executed in 16 ms
Criteria executed in 15 ms

Criteria in this situation runs faster than the SQL execution.

My recommendation, use Criteria for simple selections, and SQL for the more complex.