CSC/ECE 517 Fall 2009/wiki3 12 Patterns for ORM

From Expertiza_Wiki
Jump to navigation Jump to search

Overview

Object-relational mapping is not trivial. Apart from being based on Software Engineering principles like coupling, cohesion and polymorphism, the object paradigm focuses on building applications out of objects that have both data and behavior. However, the relational paradigm is based on mathematical principles and focuses primarily on storing data. If only data objects were to be mapped to the relational database the procedure would have been fairly straightforward. With the growing complexities of object models, concepts like aggregation, inheritance, polymorphism, association between classes, and data type (smarted than SQL data types) have to be mapped to relational table structure. The table below highlights the fundamental mismatch between object oriented data model and relational data storage.

Inheritance Mapping

Single Table Inheritance

Class Table Inheritance

Concrete Table Inheritance

Association Mapping

One-to-one mapping

One-to-many mapping

Many-to-many mapping

Aggregation Mapping

Single table aggregation

Foreign key aggregation

Conclusion

References