Lesson 1
Lesson 1
Object Relational Mapping (ORM): Is the programming technique to map application domain
model objects to the relational database tables (object fields to table columns).
In Java, JPA facilitates Object Relational Mapping.


JPA (Jakarta Persistence API): formerly known as Java Persistence API, is a specification
that facilitates object relational mapping to manage relational data in Java applications.
It provides platform to work directly with objects instead of using SQL Statements.
Name was changed by the Eclipse Foundation when took the library.

Popular implementations of JPA are as follows:
(i)Hibernate
(ii)EclipseLink
(iii)TopLink
(iv)MyBatis
JPA is just standard specifications.
Hibernate Object Relational Mapping (ORM) Framework
Hibernate is a java based ORM tool that provides a framework for mapping application domain
objects to the relational database tables and vice versa.
Is the framework for persisting/saving Java Objects in a database.
Official Website for Hibernate: hibernate.org

Hibernate provides JPA Implementation that maps your database records to Java Objects and
generate required SQL Statements to replicate all operations to the database.

Hibernate internally uses JDBC for all database communications, it uses JDBC to interact with
database.

Hibernate acts as an additional layer on top of JDBC and enables you to implement a database -
independent persistence layer.
Benefits of Hibernate:
Hibernate handles all the low-level SQL Query by minimizing the amount of JDBC code you
have to write.
Hibernate provides ORM (Object to Relational Mapping)

Hibernate vs Spring Data JPA
Spring Data JPA is an abstraction layer on top of JPA to reduce the amount of boilerplate code
required to implement data access object (DAO) layer.
Hibernate is a JPA provider (JPA Specification Implementation), Spring Data JPA is not a JPA
provider, It simply hides the Java Persistence API and the JPA Provider behind its repository
abstraction.
Spring Data JPA uses Hibernate as a default JPA provider.
Spring Data JPA can not work without JPA Provider