Correct HQL stmt generation