2011-08-21 2 views
0

Grails 질의에는 order by 절이 있지만 결과가 돌아 오면 그 필드에 의해 정렬되지 않습니다. 데이터베이스에서 동일한 쿼리를 실행하면 올바르게 작동합니다. a 오프Grails Order By Not Working

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은 Hibernate 화학식 필드이다. 이것이 그걸 할 수 있을까요? 감사.

답변

1

이와 같은 문제를 해결하는 가장 좋은 방법은 최대 절전 모드로 생성 된 SQL을 덤프하는 것입니다. DataSource.groovy에 다음을 추가하십시오.

loggingSql = true