Skip to main content

ORM

ORM concept

What is the ORM?

The ORM (Object Relational Mapping) is a programming technique that allows the linking of objects with the data that they represent. From this dynamics, it achieves that the data access tasks are simplified for the programmer. In Spanish it is also known as Object-Relational Mapping.

Its use has increased in recent years, surpassing the SQL code for the ability to delimit the number of records in a query, while freeing the programmer from manual writing to create the queries and manage the data in the RDBMS. From this dynamic, Allows database mapping to be automatic.

The ORM It contains tools that allow the conversion of objects to be stored in a relational database. It also gives the opportunity to use the characteristics of object orientation, mainly inheritance and polymorphism. Similarly, when you retrieve the stored data from the relational database, the records become objects.

Finally, works as an intermediate solution that bridges the gap between object-oriented language handling and relational database, facilitating the programmer's task and ensuring that data access is automatic.

What is the ORM for

It serves so that the database programming procedure is quick, as well as for reduce codes inserted in tables and make mapping as automatic as possible. All this, without the need for the programmer to insert codes and adapt them to the different tables according to the modifications required in the app.

Some of the advantages of the ORM can be found in the security it provides to the data access layer against attacks.  Besides, the ease of maintaining the code and its own language for querying. Even though the latter can generate certain difficulties, since to make good use of the ORM, a deep knowledge of its operation is required.

ORM examples

Examples of ORMs that can be mentioned include Hibernate, iBatis, Entity Frameworks, Doctrine, Propel, DataObjects.net, Torque, Torpor, Django and many more adapted for different programming languages such as Java, PHP, Python and Net. The best known is Hibernate for Java.

Although there are usage packages available for Object-Relational Mapping on the market, many programmers prefer to create their own tools.

More information about ORM

Would you like to know more about the ORM? Next, we suggest reading the following posts related to the topic: