Not sure what there is to fix/improve here. As you said, if your underlying DB does not support "distinct", leave it out of the HQL and apply the result transformer. Am I missing anything?