// the altered projection using DISTINCT), of which this is the only one in the code base,
// and we are in control of the order by clause, and therefore are predictably working with
// the JPQL above, I've chosen to just make a change to the custom altered projection, using
// the JPQL to guide me.
generator.alterProjection(" distinct orderingField0");
generator.alterCountProjection(" count(distinct orderingField0)");
CriteriaQueryRunner<MeasurementDefinition> queryRunner = new CriteriaQueryRunner(criteria, generator,
entityManager);
definitions = queryRunner.execute();
// Reset paging -- remove ordering, add group by.