Grails How to set resultTransformer on DetachedCriteria?

34 Views Asked by At

In Grails 3.1 I have this code:

def criteria = new DetachedCriteria(SampleObject).build {}
criteria.projections {
    property('id')
}
criteria.list()

That returns a list of ids (Long). But I want a list of SampleObject with the id.

The problem is I dont find the method "setResultTransformer" on DetachedCriteria to do something like:

criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY)

There is a way to transform the result in a bean using DetachedCriteria?

0

There are 0 best solutions below