Skip to main content

Spring Data for Spring Boots

Spring Data is the persistence layer of Spring Boot, wrapping JPA and Hibernate behind repository interfaces. You declare an interface extending JpaRepository and get CRUD methods and derived queries for free. It also covers schema migrations with Flyway or Liquibase and transaction management with @Transactional, which keeps data changes consistent.

Stage: Data · Part of the Spring Boot roadmap · Last reviewed 19 November 2026

What to learn in Spring Data

Spring Data interview questions

What is the N+1 problem in JPA?

It happens when loading a list of parent entities triggers one query for the list and then one extra query per parent to load a lazy child collection. With a thousand parents that means 1001 queries. Fix it with fetch joins, entity graphs or batch fetching.

What does @Transactional do by default?

It wraps a method in a transaction through a Spring proxy: the transaction commits on success and rolls back on unchecked exceptions by default. Checked exceptions do not trigger rollback unless configured. Self-invocation inside the same class bypasses the proxy, so the annotation has no effect there.

Where Spring Data fits in the Spring Boot roadmap

Spring Data belongs to the Data stage (intermediate level), which takes about 21 hours. Persistence.

Back to the full Spring Boot roadmap