CriteriaExecutor criteriaExecutor = new CriteriaExecutor() {
protected Criteria getCriteria(Session s) throws Exception {
return s.createCriteria( Student.class, "s" )
.setProjection( Projections.property( "s.name" ) )
.addOrder( Order.asc( "s.studentNumber" ) )
.setResultTransformer( new AliasToBeanConstructorResultTransformer( getConstructor() ) );
}
private Constructor getConstructor() throws NoSuchMethodException {
return StudentDTO.class.getConstructor( PersonName.class );
}
};