次のドメイン モデルがあるとします。
class Book {
String title
Set authors
static hasMany = {authors: Author}
}
class Author {
String name
}
タイトル Book に対するクエリを指定して Author のコレクションを取得する HQL クエリ:
Author.executeQuery("select distinct author from Book as book join book.authors as author where book.name like ?", ["%groovy%"])
しかし、私は DetachedCriteria または同様のものを使用して同じ結果を得ることができます (しかし、それは可能ですか?)、 Author から Book への関係を追加しません (そうでなければ、かなり明白です)
ありがとう