JPA
The Jakarta standard for mapping Java objects to relational database tables and managing them, implemented by libraries such as Hibernate.
In more detail
JPA once stood for Java Persistence API and is now Jakarta Persistence. You annotate classes as entities and it handles reading and writing rows, tracking changes inside a persistence context and running transactions. The mapping is not the database design itself: indexes, constraints and migrations still need explicit care.
Related terms
- Hibernate — The most widely used implementation of JPA, and the one Spring Boot uses by default, which maps entities to tables and generates SQL.
- JPA entity — A class marked @Entity whose instances JPA stores as rows in a table, identified by a field marked @Id.
- persistence context — The set of entities JPA is currently tracking in a unit of work, whose changes it writes to the database automatically.
- ORM — A library that lets code read and write database rows as ordinary objects, generating the SQL for you.
- Spring Data JPA — A Spring project that generates repository implementations from interfaces, so declaring an interface is enough to get common database operations.
Taught in
- Implementing An OpenAPI Contract — Modern Java: Virtual Threads & High-Throughput Services
- Persistence With JPA And Hibernate — Modern Java: Virtual Threads & High-Throughput Services
- Spring Data Repositories — Modern Java: Virtual Threads & High-Throughput Services