What are the main problems of Object Relational Impedance Mismatch?

Object model and Relational models (RDBMS) have following problems that are part of Object Relational Impedance Mismatch:

  • Granularity: Object model is more granular than Relational model. There are more classes in object model than the corresponding tables in relational model.
  • Inheritance: Object model supports inheritance. But Relational model does not have any concept of inheritance.
  • Identity: Relational model has just one criteria for sameness of data. It is based on primary key. In object model like Java we can have equals as well as == for sameness of objects.
  • Associations: In Object model associations are uni-directional. In RDBMS, there is a concept of foreign key for association. Also multiplicity of a relationship is hard to judge by looking at object model.
  • Data navigation: In Object model, you can move from one object to another object for getting data. Egg. you can retrieve and Employee object, then go to its department object and then get the employees in the department object. In RDBMS, we try to minimize the SQL calls, so we get all the data by using joins.
Read the full book at www.amazon.com
Posted in Hibernate, Hibernate Interview Questions

Leave a Reply

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

*