Criteria builder not working

This just throws a org.hibernate.exception.SQLGrammarException, if I remove the withProjections it works fine. What is the correct way to do this?

var criteria = commentService.newCriteria();

criteria.eq(“relatedContent.contentID”, javaCast(“int”, comment.getrelatedContent().getContentId() ));

criteria.ne( “authorEmail”, comment.getAuthorEmail() );

criteria.withProjections(distinct = “authorEmail”);

results = criteria.list();

Try adding an alias on the distinct property:

criteria.withProjections( distinct = “authorEmail:authEmail” );

Damn, I should have clicked to that one :frowning:

Cheers again…