Grails Order By Not Working
I have a Grails query that has an order by clause, but when the results come back they are not ordered by that field. If I run the same query in the database it works correctly.
String sql = "select child From Affiliation a join a.childrenPhases cp join cp.affiliation child where a = :affiliation and child.type = '${TYPE_CONFERENCE}' order by a.name asc"
return executeQuery(sql, [affiliation: this])
name
off of a
is a hibernate formula field. Could this have to do开发者_StackOverflow中文版 with it? Thanks.
The best way to troubleshoot a problem like this is to dump the SQL generated by hibernate. Add the following to your DataSource.groovy:
loggingSql = true
精彩评论