Bug fix in HQL query.