14 · Hibernate and Spring Data JPA in depth / LESSON 62 OF 102
JPA versus Hibernate versus Spring Data
These technologies occupy different layers and solve different amounts of the persistence problem.
Before this lesson: Service transactions and durable CRUD
Understand the topic
Jakarta Persistence defines ORM contracts and annotations. Hibernate is a provider implementing those contracts with additional capabilities. Spring Data JPA builds repository abstractions on top, generating common persistence behavior from interfaces and declarations.
JDBC still carries SQL to the database underneath an ORM. Repository convenience does not remove the need to understand SQL, transactions, or schema constraints. Let the Boot dependency platform manage compatible provider versions.
EXAMPLE · SHELL
Layer inspection
./mvnw dependency:tree -Dincludes=org.hibernate.orm:hibernate-core
./mvnw dependency:tree -Dincludes=org.springframework.data:spring-data-jpaWhat to expect
The resolved dependency graph identifies the provider and repository abstraction used by the generated Boot JPA project.
YOUR TURN
Put it into practice
- 01Trace a repository save call down to emitted SQL.
- 02Identify the repository proxy, EntityManager, provider, JDBC driver, and database in the path.
- 03Verify: You explain each layer without calling JPA itself a database or Hibernate a JDBC driver.
Pass a quiz or complete a lab to check today’s streak. Each lesson counts once per day, including when you review it later.
UNDER THE HOOD
Build the mental model
These technologies occupy different layers and solve different amounts of the persistence problem.
- 01Jakarta Persistence defines ORM contracts and annotations. Hibernate is a provider implementing those contracts with additional capabilities. Spring Data JPA builds repository abstractions on top, generating common persistence behavior from interfaces and declarations.
- 02JDBC still carries SQL to the database underneath an ORM. Repository convenience does not remove the need to understand SQL, transactions, or schema constraints. Let the Boot dependency platform manage compatible provider versions.
- 03Trace the example: The resolved dependency graph identifies the provider and repository abstraction used by the generated Boot JPA project.
A mistake worth avoiding
A JPA annotation import uses javax.persistence in a modern Jakarta application.
DEBUGGING ROOM
Something broke. Where do you look?
A JPA annotation import uses javax.persistence in a modern Jakarta application.
Before revealing the diagnosis, write down your first investigation step.
CHECK YOUR UNDERSTANDING
Is Spring Data JPA the ORM provider?
BUILD IT YOURSELF
Trace a repository save call down to emitted SQL.
- 1.Trace a repository save call down to emitted SQL.
- 2.Identify the repository proxy, EntityManager, provider, JDBC driver, and database in the path.
- 3.Reproduce this failure, then repair it: A JPA annotation import uses javax.persistence in a modern Jakarta application.
Acceptance checklist
Lab completion is your self-report. Knowledge checks do not certify project quality.
RETRIEVE IT FROM MEMORY
Is Spring Data JPA the ORM provider?
Revisit this lesson in three days after a successful check or lab.
Ready for the next step?
You explain each layer without calling JPA itself a database or Hibernate a JDBC driver.
Reading is separate from passing a knowledge check or completing a lab.