Repaso
EspaƱol
Spring, JPA & Java WebFoundationsSPR-44

What are JPA (Jakarta Persistence) and Hibernate?

Options

  1. JPA is a mapping specification; Hibernate implements it (Correct option)
  2. Both are web servers that are used to run Java apps
  3. JPA is a database engine; Hibernate is its backup tool
  4. 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.

Key terms

Practice this question in Repaso