What is the difference between JPA and Hibernate this question is asked when attending and Wipro telephonic interview below I try to give an answer what is the difference between  Hibernate and JPA?

Wipro interview question difference between Hibernate and JPA
 Hibernate and JPA

What is Hibernate?
Hibernate is known as ORM (Object Relational Mapping) framework and it is developed by Gavin King using Java language.
It provides a framework for mapping an object-oriented domain model to a relational database.
In a simple way, hibernate is used to communicate with the database.

What is JPA?
JPA stands for Java Persistence API, which enables you to map database tables and columns into Java Objects using annotations.
 JPA is just a set of interfaces that requires implementation.
Its implementations are available for language specifications like Hibernate, EclipseLink, etc.

Difference between hibernate and JPA.

JPA Hibernate
JPA is a specification, meaning there is no implementation or it will not provide any functionality within your application. Hibernate is one of the popular JPA implementations.
JPA itself doesn’t provide any implementation classes. You need a JPA provider that implements the specification and the most popular ones are Hibernate and EclipseLink.
In JPA EntityManager API is used to create and remove persistent entity instances, to find entities by their primary key, and to query over entities. In Hibernate, Session is to offer create, read and delete operations for instances of mapped entity classes.
JPA defines its own query language, called JPQL. Hibernate defines its own query language, Hibernate Query Language (HQL).
JPA is the EE standard specification for ORM in Java EE which is present in javax.persistence package. It is present in org. hibernate package.


Advanatge of Using JPA.

In the future, if you want to change hibernate to any other implementation you can easily switch without much headache and basic properties include JPA annotations which can work for any implementation like EclipseLink, TopLink, etc Click here.

Post a Comment

Previous Post Next Post