I\'ve got an simple Hibernate entity for which I use the @Formula annotion:
@Id private Long id; private String name; @Formula(\"(select count(f.*) fro
We could use currentSession.createQuery() instead of currentSession.createSQLQuery(). The query will be slightly different.
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/queryhql.html#queryhql-subqueries