12- JPA, Spring Data JPA and Hibernate
What is JPA?
Java Persistence API (JPA) is a specification of Java.
It is used to persist data between Java object and relational database.
JPA acts as a bridge between object-oriented domain models and relational database systems.
As JPA is just a specification, it doesn't perform any operation by itself.
OR
In simple terms JPA provide APIs to map java object to relational database.
OR
JPA is just a specification that facilitates object-relational mapping to manage relational data in Java applications. It provides a platform to work directly with objects instead of using SQL statements.
What is hibernate?
Hibernate is a ORM (Object Relational Mapping) library which follows JPA specification.
Difference betweeen JPA and Hibernate?
JPA is only a specification, it is not an implementation but Hibernate is an implementation of JPA guidelines
JPA is a set of rules and guidelines to set interfaces for implementing object-relational mapping, Hibernate helps in mapping Java data types to SQL data types.
OR
In simple terms You can think JPA as a set of Rules which is implemented by Hibernate.
What is DAO layer?
The Data Access Object (DAO) pattern is a structural pattern that allows us to isolate the application/business layer from the persistence layer (usually a relational database but could be any other persistence mechanism) using an abstract API.
The API hides from the application all the complexity of performing CRUD operations in the underlying storage mechanism. This permits both layers to evolve separately without knowing anything about each other
OR
In simple Terms Repository and Entity Bean represent the DAO layer in the application.
What is Spring Data JPA?
Spring Data JPA, part of the larger Spring Data family, makes it easy to easily implement JPA based repositories.
Spring Data JPA is an add on for JPA..
In simple words JPA has a lot of boiler plate code ...Spring Data JPA is a module that reduces the boiler plate code
Comments
Post a Comment