【发布时间】:2012-01-20 14:11:49
【问题描述】:
假设我有以下领域模型:
class Book {
String title
Set authors
static hasMany = {authors: Author}
}
class Author {
String name
}
在给定书名查询的情况下,检索 Author 集合的 HQL 查询:
Author.executeQuery("select distinct author from Book as book join book.authors as author where book.name like ?", ["%groovy%"])
但是我希望能够在 DetachedCriteria 或类似的情况下获得相同的结果(但有可能......?)并且不添加从 Author 到 Book 的关系(否则它会很明显)
谢谢
【问题讨论】:
标签: grails hql grails-orm detachedcriteria