Reputation: 22580
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 with it? Thanks.
Upvotes: 0
Views: 239
Reputation: 66059
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
Upvotes: 1