They are not. This is a very common doubt, which I even had in my first years of development with Hibernate.
JPA means Java Persistence API. Is a specification of a "Java API for persistence management and object/relational mapping in Java EE and Java SE environments".
Basically, JPA brings together a set of rules that allows anyone to implement this API, allowing them to use this implementation in any project that uses JPA interfaces, thus ensuring a certain compatibility between different implementations.
This is where the Hibernate. Hibernate is an implementation of the JPA specification, certainly the most common and used. In addition to Hibernate, we also have other JPA implementations, such as Openjpa and Eclipselink. It is common for many people to treat Hibernate and JPA as if they were one thing, so it is common for you to have a specific JPA question but to find the answer in a question that only mentions Hibernate in it. This confusion only exists because of the greater popularity of Hibernate.
In theory, if you are not using any unique features of any implementation (which is relatively common), you can exchange one implementation for another in your project transparently. For example, a common entity mapping involves annotations as @Column
, @Table
, @Id
, etc, and they are all part of the package javax.persistence
, common to any JPA implementation. Thus, a Hibernate exchange for Openjpa (for example) would transparently occur for the application.