【发布时间】:2013-09-21 04:33:50
【问题描述】:
这是我的 grails 域对象的精简版:
//this is a lookup table
class PetType {
String description
}
class Family {
static hasMany = [
petTypePreferred:PetType
]
}
在我的控制器中,我从 gsp 返回了一个参数字符串值“petTypePreferred”。知道该字符串值并知道域类 Family,我如何从“petTypePreferred”字符串值中确定域类?在 grails 2.2.4 中,getPropertyByName(String value) 方法在域对象上被视为无效,即使它在 javadoc 中也是如此。
所以我有 String petTypePreferred 和 Class Family,但我需要根据这两条信息找到 Class PetType。
【问题讨论】:
标签: grails