Difference between Hibernate and JPA

I have two questions.

  1. Why JPA came into picture, even though hibernate was there?
  2. Hibernate came before JPA. But still, why do hibernate follows JPA specifications?
  1. Why JPA came into picture, even though hibernate was there?

Because there wre other ORM implementations besides Hibernate, and JPA emerged as the standard API.

  1. Hibernate came before JPA. But still, why do hibernate follows JPA specifications?

Because the Java EE application servers use JPA, and Spring Data JPA uses the standard API. If Hibernate did not implement the JPA spec, it would be less practical.

Even if Hibernate implements the JPA spec, it also provides many additional features. For more details, check out this StackOverflow answer.