JPA = Java Persistence API
It's not a framework, but a specification (a set of rules/interfaces).
It defines how to map Java objects (classes) to database tables using annotations like:
@Entity, @Column, @Id, @OneToMany, etc.
🧠 Think of JPA as a contract: it says "Here’s how you should describe an entity and how to query it", but it doesn’t actually run the code.
jakarta.persistence
(and javax.persistence
)?These are just packages (namespaces), like folders.
Namespace | Meaning |
---|---|
javax.persistence.* |
Old name (Java EE 5–8) |
jakarta.persistence.* |
New name (Jakarta EE 9+) |
💡 They both contain the same JPA API — just moved because Oracle wouldn’t let the Java EE team evolve javax
.
So yes — these packages contain the annotations and interfaces you use to define entities and queries.
🧩 They're like the "language" you use to describe how Java maps to SQL.
✅ Hibernate is a real framework — a concrete implementation of JPA.
Hibernate does the actual work: