Spring Data JPA Reference Documentation
The official reference for Spring Data JPA: repositories, query methods, @Query, projections, specifications, locking and transactions on top of JPA and Hibernate. Explains what your one-line repository methods really run against the database.
3.3k (spring-data-jpa)
GitHub · Sept 2026
4.1.1 (stable)
Spring docs · Sept 2026
Guide
Web Development
Broadcom (Spring team)
A week alongside a Spring Boot project
Intermediate
Free
What Spring Data JPA is
Spring Data JPA is the Spring project that sits on top of JPA, the standard Java API for mapping classes to relational tables, and Hibernate, the library that does the mapping in a Spring Boot app. Its big idea is the repository: you declare an interface such as PostRepository extends JpaRepository<Post, Long>, and Spring writes the implementation for you, including queries derived from method names. This reference, maintained by the Spring team, covers the 4.1.x line as of September 2026.
What the reference covers
- Getting started and core concepts: entities, repository interfaces and the choice between
Repository,ListCrudRepositoryandJpaRepository. - Configuration and entity persistence: how
savedecides between insert and update, and how entities are tracked. - Query methods: derived queries such as
findByAuthorIdOrderByCreatedAtDesc,@Querywith JPQL or native SQL, paging and sorting withPageable. - Projections: interface and record based projections that load only the columns a response needs.
- Specifications and Query by Example for dynamic filters.
- Transactionality and locking: default transaction settings on repositories,
@Transactionaland optimistic and pessimistic locks. - Auditing, custom repository implementations, AOT optimisations and an FAQ.
Is it worth reading, or is a tutorial enough?
A tutorial gets a repository working in ten minutes. The reference is what stops it becoming slow or surprising in production. It explains when a derived query name turns into a join, why save on a detached entity runs a select first, how projections avoid loading whole entities and how repository methods take part in transactions. Most performance problems in Spring apps come from queries nobody looked at, and these chapters show you what to look for.
What to read first
- Core concepts and repository interfaces.
- Query methods, including paging and sorting.
- Projections, before you write your first list endpoint.
- Transactionality and locking, before anything that moves money or stock.
- Specifications when your search screen needs optional filters.
Prerequisites
Java 17 or later, a working Spring Boot app, and basic SQL: tables, keys, joins and indexes. Knowing a little JPA, such as @Entity and @ManyToOne, helps, because Spring Data builds on it rather than replacing it.
Common questions
Is it free? Yes. It is open source under the Apache 2.0 licence.
Do I still need to learn SQL? Yes. You will read the SQL Hibernate generates to fix slow endpoints, and write migrations by hand with a tool such as Flyway.
What can I do after it? Build a clean data layer for a Spring Boot API with repositories, paged queries, projections and correct transaction boundaries.
Best for: Java developers using Spring Boot with PostgreSQL or another relational database who want their data layer to be fast and predictable.
Ready to start?
Opens on Broadcom (Spring team) in a new tab.
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
Follow along
New writing, resources and project ideas land here first.