JPA (Java Persistence API), now standardized as Jakarta Persistence, is the Java specification for object-relational mapping that lets applications persist, query, and manage Java objects against a relational database through a standard, vendor-neutral API.
JPA
JPA (Java Persistence API) — now maintained as Jakarta Persistence — is the Java specification for object-relational mapping (ORM). It defines how Java objects map to relational tables and gives applications a standard, vendor-neutral way to persist, retrieve, and query that data without writing raw SQL for every operation. Providers like Hibernate and EclipseLink implement the specification behind the scenes.
- Object-relational mapping - Annotations or XML describe how entity classes and their fields correspond to tables and columns.
- An EntityManager and persistence context - A managed lifecycle handles loading, dirty tracking, and flushing changes to the database.
- JPQL and the Criteria API - A portable object-oriented query language and a type-safe programmatic query builder replace hand-written SQL.
- Provider independence - The same mapped entities run on Hibernate, EclipseLink, or another compliant implementation.
In API operations, JPA typically lives in the data-access layer beneath a service’s public interface — the entities it maps are what an OpenAPI-described resource ultimately reads from and writes to. It shapes how cleanly a database can be exposed as an API, since the entity model, relationships, and query patterns defined in JPA tend to flow directly into the request and response schemas that consumers and agents see. Getting that persistence layer right is often the quiet groundwork behind a well-designed API.