• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » What is Object-Relational Mapping?

By Abhishek Ghosh November 5, 2021 6:25 pm Updated on November 5, 2021

What is Object-Relational Mapping?

Advertisement

Object-relational mapping (ORM) is a software development technique that allows an application program written in an object-oriented programming language to store its objects in a relational database. The database then appears to the program as an object-oriented database, which facilitates programming. This technique is usually implemented with class libraries, such as Entity Framework for .NET programming languages, Hibernate for the Java programming language, Doctrine for PHP, SQL Alchemy for Python, Active Record for Ruby, or Diesel for Rust. For Java, there is also a standardized interface, the Jakarta Persistence API.

Object-oriented programming languages encapsulate data and behaviour in objects, whereas relational databases place data in tables. The two paradigms are fundamentally different. In this way, objects encapsulate their state and behaviour behind an interface and have a unique identity. Relational databases, on the other hand, are based on the mathematical concept of relational algebra. This conceptual contradiction became known in the 1990s as an object-relational impedance mismatch.

To resolve or at least mitigate the contradiction, various solutions have been proposed, such as object-oriented databases or the extension of programming languages with relational concepts (for example, embedded SQL). The direct object-relational mapping of objects to relations has the advantage that on the one hand, the programming language itself does not have to be extended and on the other hand, relational databases are available as established technology in all environments as mature software. The disadvantage of this approach, which is accommodating to the object-oriented programming language paradigm, is that the strengths and capabilities of relational databases are sometimes not used, which can translate into non-optimal performance.

Advertisement

---

In the simplest case, classes are mapped to tables, each object corresponds to a table row, and a table column is reserved for each attribute. The identity of an object corresponds to the primary key of the table. If an object has a reference to another object, it can be represented with a foreign key-primary key relationship in the database. The term shadow information refers to additional data that an object needs to be stored persistently. This includes primary keys – especially if they are surrogate keys of no technical significance – as well as auxiliary data for access control, such as timestamps.

 

Mapping of Inheritance Hierarchies

 

There are essentially three different ways to map inheritance hierarchies to database tables. Some frameworks offer further variations and mixtures of these three basic methods.

Table per inheritance hierarchy: In this procedure, all attributes of the base class and all classes derived from it are stored in a common table. In addition, a so-called “discriminator” is stored in another column, which determines which class the object stored in this row belongs to. In most cases, however, attributes of derived classes may not be provided with a NOT NULL constraint in this approach. In addition, restrictions on the number of allowed columns per table can thwart this approach for large classes or class hierarchies.

What is Object-Relational Mapping

Table per subclass: In this procedure, a table is created for the base class and another table is created for each subclass derived from it. A discriminator is not needed because the class of an object is defined by a 1-to-1 relationship between the entry in the base class table and an entry in one of the tables of the derived classes.
Table per specific class: Here, the attributes of the abstract base class are included in the tables for the concrete subclasses. The table for the base class is omitted. The disadvantage of this approach is that it is not possible to use a query to discover instances of different classes.

Another method is the mapping of structures (relationships, inheritance) and data in general tables. The entire database contains exactly 5 tables: one for classes, one for relationships (including inheritance relationships), one for attributes, one for instances (of the classes), and one for values (of the attributes). However, this procedure has little significance in practice.

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to What is Object-Relational Mapping?

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • Changing Data With cURL for OpenStack Swift (HP Cloud CDN)

    Changing Data With cURL For Object is Quite Easy in OpenStack Swift. Here Are Examples With HP Cloud CDN To Make it Clear. Official Examples Are Bad.

  • What Are Object-Oriented Databases

    An object-oriented database is a database that is based on the object database model. In contrast to the relational database, data is managed here as objects in the sense of object-orientation. The associated database management system is called the object-oriented database management system. Object database and object database management system together form the object database […]

  • Theoretical Foundations of Big Data : Part 3

    Theoretical Foundations of Big Data is third and final part of our series of articles. We have talked about Data Mining, OLAP & softwares.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy