CrudRepository and JpaRepository are Spring Data repository interfaces used for database operations. CrudRepository provides fundamental CRUD functionality, while JpaRepository extends it and offers additional JPA-specific capabilities such as pagination, sorting, batch operations, and persistence context management.
Repository
↓
CrudRepository
↓
PagingAndSortingRepository
↓
JpaRepository
Consider a small inventory application that only needs to add, update, retrieve, and delete products. In this case, CrudRepository is sufficient because advanced features such as pagination and batch processing are not required.
import org.springframework.data.repository.CrudRepository;
public interface ProductRepository
extends CrudRepository<Product, Long> {
}A concise interview answer is: CrudRepository provides basic CRUD operations and is suitable for simple applications that only need standard database interactions. JpaRepository extends CrudRepository and adds advanced JPA features such as pagination, sorting, flushing, and batch processing. In most enterprise applications, JpaRepository is preferred, while CrudRepository is useful for lightweight applications with simple CRUD requirements.
Last updated: 11 November 2026
Previous question: What is the difference between @Component and @Service? Are they interchangeable?
Next question: What is the difference between @Qualifier and @Primary, and when is each used?