Monday, January 30, 2017

Object Relational Mapping (ORM)

Object Relational Mapping (ORM)

Consider a scenario where there is an object in a POJO and the relevant table which stores the object's attribute values (EX. An Employee class and an employee table)

Employee class would have the following format

Class Employee {

private int EmpId;
private String name;
private String companyName;
private double salary;
..
..
..
}

Employee table in the Database would have the following format

EmpId | name | companyName | salary


Since the table and object structures are different, it is difficult to do the CRUD operations with minimal dependency. So a middle layer is introduced (which is called Object Relational Mapping) so that the link between table and ORM, and the link between the ORM and the class can be seperately defined

Hibernate is an example of an ORM

No comments:

Post a Comment