Many-to-Many Relationships
One of the concerns about bringing in a sponsor for a technical event is that the whole thing might turn into a commercial for a vendor. That becomes much less of a concern if there are multiple sponsors for an event. On the other hand, a single company might be interested in sponsoring more than one event. So, should a TekEvent have a collection of Sponsor instances, or should Sponsor have a collection of TekEvent instances? The short answer is both. The longer answer, which we’ll get to shortly, is neither.
The relationship between TekEvent and Sponsor is a many-to-many relationship. Grails supports many-to-many relationships implicitly by having each class include the other in its hasMany block. In this arrangement, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access