Bruno Morgado
Bruno Morgado

Reputation: 507

Grails non-existent mapping property

Having problems with domain class mappings. The domains are as follows:

User Domain

class User extends SecUser {
   static hasMany = [ratings:Rating, searchedResults:Results, recommendedResults:Results]
   static mappedBy = [searchedResults:"searched", recommendedResults:"recommended"]
}

Rating Domain

class Rating {
   static belongsTo = User

   Artist artist
   double rating
}   

Results Domain

class Results {
   static belongsTo = User

   def searched
   def recommended
}

When compiling it gives following error:

 Non-existent mapping property [recommended] specified for property [recommendedResults] in class [class ontourtest.User].

Any ideas why this is happening? Thanks very much!

Upvotes: 1

Views: 1146

Answers (1)

Michael J. Lee
Michael J. Lee

Reputation: 12406

Try changing the def searched and def recommended in the Results class to their actual types (example Thing searched, Thing recommended). I'm not sure what type they're supposed to be and i think grails doesn't know either.

See the documentation

Note: there is a type-o in the documentation ;)

Upvotes: 4

Related Questions