← Spring Boot learning pathSpring Boot · Module 4 of 10
Spring Data JPA
Store and query data with repositories and entities.
📖 Key ideas
- @Entity maps a class to a table; @Id marks the primary key.
- interface UserRepository extends JpaRepository<User, Long>.
- Built-in methods: save, findById, findAll, deleteById.
- Derived queries: findByEmail(String email).
- Hibernate is the default JPA implementation.
💡 Real-life example: A repository is a librarian: ask "find by email" and it fetches the record without you writing SQL.
@EntityClass mapped to a table
JpaRepositoryReady CRUD repository
Derived queryQuery from the method name
HibernateJPA implementation