Spring Boot JPA vs Hibernate


Advertisements

JPA

JPA is a specification which specifies how to access, manage and persist information/data between java objects and relational databases. It provides a standard approach for ORM, Object Relational Mapping.

Hibernate

Hibernate is an implementation of JPA. It provides a lightweight framework and is one of the most popular ORM tool used.

JPA Vs Hibernate

Following table summerises the differences between JPA and Hibernate.

Category JPA Hibernate
Type JPA is a specification and defines the way to manage relational database data using java objects. Hibernate is an implementation of JPA. It is an ORM tool to persist java objects into the relational databases.
Package JPA uses javax.persistence package. Hibernate uses org.hibernate package.
Factory JPA uses EntityManagerFactory interface to get the entity manager to persist objects. Hibernate uses SessionFactory interface to create session object which is then used to persist objects.
CRUD Operations JPA uses EntityManager interface to create/read/delete operation and maintains the persistence context. Hibernate uses Session interface to create/read/delete operation and maintains the persistence context.
Language JPA uses JPQL (Java Persistence Query Language) as Object Oriented Query language for database operations. Hibernate uses HQL (Hibernate Query Language) as Object Oriented Query language for database operations.
Advertisements