域类映射存在问题。域如下:

用户域

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].

任何想法为什么会这样?非常感谢!

最佳答案

尝试将def searched类中的def recommendedResults更改为其实际类型(示例Thing searchedThing recommended)。我不确定它们应该是哪种类型,我也认为grails也不知道。

documentation

注意:文档中有一个type-o;)

关于grails - Grails不存在的映射属性,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6789332/

10-13 02:04