• 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.

This Article Has Been Shared 722 Times!

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?

  • Why Hadoop Distributions Like From Cloudera, Hortonworks Exist?

    If You Are New in Data Science/Big Data, it is Normal to Ask Yourself Why Hadoop Distributions Like From Cloudera, Hortonworks Exist?

  • Install Apache Chukwa on Hadoop Cluster

    Apache Chukwa is a data collection and Analysis Framework. Here Are the Steps to Install Apache Chukwa on Hadoop Cluster.

  • Relationship Between Process Mining and Business Intelligence

    Learn what differentiates Process Mining from Business Intelligence, what problems it can solve and how companies can get started.

  • Machine Learning in Capital Markets : Part VII

    This is the continuation of part VI of Machine Learning in Capital Markets. In the course of this work, a critical examination of the use of various learning methods in the analysis of financial market-specific data showed that machine learning methods are only conditionally suitable for successfully predicting share prices. A look at the results […]

  • What is Information Silo?

    An information silo is a management system incapable of mutual exchange with other similar systems. Information silo is a derogatory expression that can be used to describe a lack of operational reciprocity. Derived variants are silo thinking, silo vision and silo mentality. In an Information Silo, the data is not properly shared. It remains within […]

Additionally, 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 (22.1K 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

  • How Telecoms Can Use The Cloud To Power Their 5G Network June 24, 2022
  • A Beginner Guide to Cloud Computing for Development June 22, 2022
  • 5 Benefits of Using a Virtual Data Room Today June 19, 2022
  • Top System Administration Courses 2022 June 18, 2022
  • The Best Business VPNs for 2022 June 17, 2022

About This Article

Cite this article as: Abhishek Ghosh, "What is Object-Relational Mapping?," in The Customize Windows, November 5, 2021, June 25, 2022, https://thecustomizewindows.com/2021/11/what-is-object-relational-mapping/.

Source:The Customize Windows, JiMA.in

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Privacy Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

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

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