What are JPA (Jakarta Persistence) and Hibernate?
Options
- JPA is a mapping specification; Hibernate implements it (Correct option)
- Both are web servers that are used to run Java apps
- JPA is a database engine; Hibernate is its backup tool
- JPA is a testing tool; Hibernate is a build system
Answer
JPA is a specification for mapping Java objects to database tables; Hibernate is a popular implementation of it (an ORM)
Why
An ORM (object-relational mapper) lets you work with Java objects instead of writing SQL for every operation: it converts objects to rows and back.
JPA defines the standard API (annotations like @Entity, @Id). Hibernate is software that implements it.
JPA was called Java Persistence API; since the move to Jakarta EE it is Jakarta Persistence, and the package changed from javax.persistence to jakarta.persistence.
Remember
JPA = the standard. Hibernate = the implementation.