使用 Book 和 Author 域类如下:
class Book {
static belongsTo = Author
static hasMany = [authors:Author]
String title
}
class Author {
static hasMany = [books:Book]
String name
}
我如何找到标题为“Grails”的作者的书?
我试过了,但是没有用(没有方法签名:org.hibernate.collection.PersistentSet.findByTitle() 适用于argumentnt类型:(java.lang.String)值:[Grails]。
Author author = Author.get(1)
def book = author.books.findByTitle("Grails")