【发布时间】:2016-07-13 12:22:15
【问题描述】:
我正在尝试通过子实体的属性创建 GORM 条件查询过滤。所以有这样的实体:
class PaymentEntry {
static hasOne = [category: PaymentCategory]
static constraints = {
category(nullable: true)
}
// other stuff
}
class PaymentCategory {
static hasMany = [payments: PaymentEntry]
// other stuff
}
现在我正在尝试选择具有特定类别的 PaymentEntries。我正在尝试这样的事情:
def c = PaymentEntry.createCriteria()
def res = c {
'in'("category", categories)
}
categories 这里是PaymentCategory 实体的列表,之前已选择。
不幸的是,这失败了。 Grails 抛出 NoSuchMethodException。
【问题讨论】:
-
哪个 Grails 版本?
标签: grails grails-orm