Thursday, June 23, 2011

How to handle Many-To-Many In Grails without belongsTo? - Stack Overflow

How to handle Many-To-Many In Grails without belongsTo? - Stack Overflow

I need to create a many-to-many relationship in Grails.

I have a "Question" domain and a "Tag" domain. A Question can have 0 or more tags. A Tag can have 0 or more Questions.

If I put a "hasMany" on each sides, it gives me an error saying I need a "belongTo" somewhere. However, adding a belongsTo means that the owner must exist...

Like I said, a Tag could have 0 questions, and a Question could have 0 tags. There is no concept of an owner, it's a many-to-many!

What am I supposed to do?

No comments:

Post a Comment