I have a list method that uses HQL. how do I add the paging and sorting parameters to this query?
def list = {
def termList
log.info "Getting terms for product: $params.productId"
params.max = 10
def p = Product.get(params.productId)
if (p) {
log.info "Product found: $p.name"
termList = Term.executeQuery("select distinct t from Term as t join t.definitions def join def.definitionProducts dp where dp.product=?",
p )
} else {
log.info "No Product found"
termList = Term.list(params)
}
log.info "Terms found: $termList.size"
[ termInstanceList: termList, termInstanceTotal: termList.size]
}