2011-08-21 48 views
0

我有一个Grails查询,它有一个order by子句,但是当结果返回时,它们不是按该字段排序的。如果我在数据库中运行相同的查询,它会正常工作。不工作的Grails订单

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关闭的a是休眠式字段。这可能与它有关吗?谢谢。

回答

1

解决类似问题的最佳方法是转储由休眠生成的SQL。将以下内容添加到您的DataSource.groovy中:

loggingSql = true