Object Relational Mapping (ORM)


Object Relational Mapping (ORM)

There is a mismatch between the object model and the relational database while working with an object-oriented system. Data is represented in a tabular fashion by RDBMSs, whereas it is described as a linked graph of objects by object-oriented languages like Java or C#.

Object-Relational Mapping (ORM) is a programming approach that converts data between relational databases and object-oriented programming languages like Java, C#, and others.

Advantages:

  • Instead of DB tables, let's have business code access objects.
  • Hides SQL query information from OO logic.
  • Under the hood, JDBC is used.
  • There's no need to worry about database setup.
  • Rather than database structure, entities are built on business concepts.
  • Transaction management and key generation are both automated.
  • Application development is completed quickly.

Entities of ORM:

The four entities that make up an ORM solution are as follows:

  • An API for performing basic CRUD actions on persistent class objects.
  • A language or API for expressing questions about classes and their properties.
  • A facility for specifying mapping metadata that can be customized.
  • A method for performing dirty checking, lazy association fetching, and other optimization operations with transactional objects.

ORM Tool:

Data production, manipulation, and access are all made easier using an ORM tool. It's a programming approach that connects an item to data in a database.

THE ORM TOOL USES the JDBC API internally to interface with the database.