REPORT-554 - updated HQL and added a unit test