Domain Object Relationships in Grails GORM And SQL Relational Databases

When doing re-factoring  for applications with SQL Databases, it may be helpful to know the details how GORM creates different relationships and how those relationships are physically structured in the DB. This post starts the post series to cover – One-To-One, One-To-Many, Many-To-Many and Inheritance for Domain objects relationships. we hope to answer following questions

  • How these relationships are physically structured in DB?
  • How these relationships  are implemented in respect to cascading and direction(bidirectional vs unidirectional) and whether it changes DB structure?

Here is summary:

Summarized – Quick Reference

Relationship Unidirectional Bidirectional
One-To-One(book*-to-author)
Many-To-One(book*-to-author)   Not Possible (see post)
One-To-Many(RentalUnit*-to-review)
Many-To-Many(RentalUnit*-to-review)
Inheritance img

Leave a Reply

Your email address will not be published. Required fields are marked *