ORM Introduction

What is Object persistence?


Today most of the development is carried out in an object oriented manner using languages like java,C++ etc.


When thinking in terms of Java as the programming language,the business logic of an application works with Objects of different class types. However when dealing with the data store,it's important to note that the tables of a database are not objects,which becomes an issue. This is where the concept of Object Persistence comes in.


Object Persistence deals with persistence in object oriented program such as java.It means determining how objects and their relationships are persisted in a relational database.


What is ORM ?


ORM Overview

What is Object persistence?


Today most of the development is carried out in an object oriented manner using languages like java,C++ etc.


When thinking in terms of Java as the programming language,the business logic of an application works with Objects of different class types. However when dealing with the data store,it's important to note that the tables of a database are not objects,which becomes an issue. This is where the concept of Object Persistence comes in.


Object Persistence deals with persistence in object oriented program such as java.It means determining how objects and their relationships are persisted in a relational database.


What is ORM ?


ORM Overview






Object Oriented Programming use Classes whereas Relational Database use tables.In programming this will creates a gap.This gap is called impedance mismatch.

We can bridge the gap between Object oriented model and Relational model is known as Object Relational Mapping(ORM).

The Object-Relational Impedance Mismatch:

Object-Relational Impedance Mismatch' (sometimes called the 'paradigm mismatch') is just a fancy way of saying that object models and relational models do not work very well together.RDBMSs represent data in a tabular format , whereas object-oriented languages, such as Java, represent it as an interconnected graph of objects.

Solution of Impedance Mismatch:

Use an ORM mapping tool which will provide a simple API for storing and retrieving Java objects directly from database.
There are several good ORM tools available in market that will do mapping between Objects and Database tables and solve the impedance mismatch.

Following are ORM tools:

  1. Hibernate
  2. OpenJPA
  3. EJB Entity Bean
  4. EclipseLink
  5. TopLink


Hibernate

Hibernate is the ORM tool given to transfer the data between a java (object) application and a database (Relational) in the form of the objects. Hibernate framework simplifies the development of java application to interact with the database.

Java Persistence API:

JPA has been introduced in Enterprise Java Beans 3(EJB3).Java Persistence API is new way of communicating with the database.
The Java Persistence API (JPA) is a standard API for accessing databases from within Java applications. The main advantage of JPA over JDBC is that in JPA data is represented by classes and objects rather than by tables and records as in JDBC.





comments powered by Disqus