Reputation: 4021
My criteria is giving me duplicate result so insted of:
def history = TerminHistorie.createCriteria().list([max:20, offset:offset])
I did :
def history = TerminHistorie.createCriteria().listDistinct([max:20, offset:offset])
But I keep getting the error:
java.util.LinkedHashMap cannot be cast to groovy.lang.Closure
How can I solve this?
Upvotes: 1
Views: 979
Reputation: 4021
This worked:
resultTransformer org.hibernate.Criteria.DISTINCT_ROOT_ENTITY
Upvotes: -1
Reputation: 3694
Try this instead:
def history = TerminHistorie.createCriteria().listDistinct {
maxResults(20)
firstResult(offset)
}
Upvotes: 2