Object-relational mapping (ORM, O/RM, and O/R mapping tool) in computer science is a programming technique for converting data between incompatible type systems using object-oriented programming languages. This creates, in effect, a “virtual object database” that can be used from within the programming language. There are both free and commercial packages available that perform object-relational mapping, although some programmers opt to construct their own ORM tools.

In object-oriented programming, data-management tasks act on objects that are almost always non-scalar values. For example, an address book entry that represents a single person along with zero or more phone numbers and zero or more addresses. This could be modeled in an object-oriented implementation by a “Person object” with attributes/fields to hold each data item that the entry comprises: the person’s name, a list of phone numbers, and a list of addresses. The list of phone numbers would itself contain “PhoneNumber objects” and so on. The address-book entry is treated as a single object by the programming language (it can be referenced by a single variable containing a pointer to the object, for instance). Various methods can be associated with the object, such as a method to return the preferred phone number, the home address, and so on.

However, many popular database products such as SQL database management systems (DBMS) can only store and manipulate scalar values such as integers and strings organized within tables. The programmer must either convert the object values into groups of simpler values for storage in the database (and convert them back upon retrieval), or only use simple scalar values within the program. Object-relational mapping implements the first approach.

The heart of the problem involves translating the logical representation of the objects into an atomized form that is capable of being stored in the database while preserving the properties of the objects and their relationships so that they can be reloaded as objects when needed. If this storage and retrieval functionality is implemented, the objects are said to be persistent.


Implementation-specific details of storage drivers are generally wrapped in an API in the programming language in use, exposing methods to interact with the storage medium in a way which is simpler and more in line with the paradigms of surrounding code.

The following is a simple example, written in C# code, to execute a query written in SQL using a database engine.

String sql = “SELECT id, first_name, last_name, phone, birth_date, sex FROM persons WHERE id = 10”;

Result res = db.execSql(sql);
String name = res[0]["first_name"];

In contrast, the following makes use of an ORM-job API, allowing the writing of code which naturally makes use of the features of the language.

Person p = repository.GetPerson(10);
String name = p.getFirstName();

Related posts

Change.org Link Down

When a petition is signed, our system mechanically emails a confirmation to the e-mail address related to that account. This email can typically have a subject matter line that begins “You have a message about…”. At the bottom of the e-mail, you may see the choice “Didn’t sign this petition? Take away your signature”. To get rid of your signature, click on the Remove your signature link. If you happen to receive a permission error, try login into change.org account and


  Yajush Khanna is a very young and dynamic businessman and at the very young age, he decided to join the family business and take it to the greater level. He did his schooling from The British School, New Delhi and a degree in Entrepreneurship and Economics from the Babson College, Massachusetts. After his graduation

Mouthshut Review Management and Down

Writing a review on MouthShut.com is as straightforward as composing email. Or maybe easier, Simply follow any of the subsequent steps to jot down your review. Option 1 1.Select the class underneath that the merchandise is listed. 2.Begin typewriting the name of the merchandise you would like to review 3.Our Intelligent Search Feature can provide you with associate degree choice of product to decide on from 4.Only when you choose the merchandise you would like to review, can the ‘Write Review’ icon be visible 5.Now proceed to jot