遇到域类映射问题。域名如下:
用户域
class User extends SecUser {
static hasMany = [ratings:Rating, searchedResults:Results, recommendedResults:Results]
static mappedBy = [searchedResults:"searched", recommendedResults:"recommended"]
}
评分域
class Rating {
static belongsTo = User
Artist artist
double rating
}
结果域
class Results {
static belongsTo = User
def searched
def recommended
}
编译时会出现以下错误:
Non-existent mapping property [recommended] specified for property [recommendedResults] in class [class ontourtest.User].
为什么会发生这种情况?非常感谢!
答案 0 :(得分:4)
尝试将def searched
课程中的def recommended
和Results
更改为实际类型(例如Thing searched
,Thing recommended
)。我不确定他们应该是什么类型,我认为grails也不知道。
注意:文档中有一个类型o;)