Hi, folllowing scenario to query for list of items from domain:
class A {
SortedSet items
}
Second line is code to be used in GSP
A1) domain and namedQuery
static namedQueries = {
filteredListItems { params ->
...
}
}
A.filteredListItems(params)
A2) domain methode
def filteredListItems = { params ->
return this.items
}
A.filteredListItems(params)
B) controller (or with criteria)
def as = A.findAllByFilter(filter,params)
as.listItems()
C) service
What is most recommended to be used as if there are more than one location where I need to query for "filteredItems"?
What about following concerns
- calculations with the results should be done only once if
- params need to be passed
- "total" is needed for paging
Thanks a lot Sebastian