How to handle Many-To-Many In Grails without belongsTo?
Posted
by nute
on Stack Overflow
See other posts from Stack Overflow
or by nute
Published on 2010-05-05T17:13:50Z
Indexed on
2010/05/05
17:18 UTC
Read the original article
Hit count: 213
grails
|many-to-many
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?
© Stack Overflow or respective owner