Here, I am gonna say a little bit more about O/R Mapping
. Since there are differences between Object and RDB, which is called impedence mismatch. So we need a bridge: O/R Mapping
. There are three kinds of mapping, attribute mapping, hierarchy mapping, relationship mapping
. In attribute mapping, an attribue could map zero or more columns in R-DB (not all attributes are persistent)
.In relationship mapping, there are 3 relationships: one2one, one2many, many2many. We could use foreign key in RDB to apply these 3 relationships. For many2many relationship, we could introduce association-table to get it.
.In hierarchy mapping, there are 3 ways to do implementation.
1.Map the entire class hierarchy to a single table