I have two domain classes with a 1: n ratio:
import Action class Task { Action actionParent String taskName }
and
class Action { String actionName }
I have a list of tasks where I have an โAction Nameโ column, I would like to sort this column by Action.actionName. Now I use the createCriteria () method [I need to use it because I have more logic to filter and sort ...], but I can only sort by "Action.id". This method is as follows:
def criteria = Task.createCriteria(); taskList = criteria.list { if(parameters.max != null) maxResults(parameters.max) if(parameters.offset != null) firstResult(new Integer(parameters.offset)) if(parameters.sort != null && parameters.order) order(parameters.sort, parameters.order) }
Is there a way to sort domain class data by relationship attributes?
Thanks for any replay,
Mateo
source share