The probem probably is that in your result there is no date column. I haven't tested it but after looking on this question: What is the sql query for this? (comment to first answer) I think that adding
property("date")
to your projections can help.
---------------- EDIT ----------------------------
Here is full ResponseService class for your problem. I've added also property("id")
to your projections clause.
class ResponseService {
def load(offset, max ) {
def idList = MyClassA.createCriteria().list (max: max, offset: offset) {
projections {
distinct ( "id" )
property("date")
property("id")
}
userList{
eq("login","toto")
}
order("date","desc")
}
if( idList ) {
// fetch all Responses based on selected IDs
def results = MyClassA.getAll( idList )
return results
}
}
}