[2.0.3] Do namedQueries use the default sort order from `mapping`?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[2.0.3] Do namedQueries use the default sort order from `mapping`?

alxndrsn
From what I'm observing, `myNamedQuery.list()` does not apply the sort
requested in `static mapping` at the top of a domain class.  Is that
to be expected?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: [2.0.3] Do namedQueries use the default sort order from `mapping`?

Marcel Overdijk
I'm noticing the same (and worse). However I would expect it to use the default sort order.

Even adding explicit order to named query does not work:

String code
Date inactiveDate

static namedQueries = {
        activeOnDate { date ->
                or {
                        isNull("inactiveDate")
                        gt("inactiveDate", date)
                }
                order("code", "asc")
        }
}


Product.activeOnDate(someDate).list()
does not order the result on the "code" column.

And even Product.activeOnDate(someDate).list(sort: "code", order: "asc") does not sort.

This is causing a problem in our app atm and we are thinking of bypassing the named queries at the moment.

Anyone an idea?