← All tutorials

GoCareerGo Tutorials

Spring Boot Tutorial

Auto-configuration, REST APIs, JPA, AOP, caching, microservices and Spring Cloud.

CrudRepository vs JpaRepository

Both give you basic CRUD operations — JpaRepository adds JPA-specific extras like pagination, sorting and batch operations.

  • CrudRepository — save, findById, findAll, deleteById, count
  • PagingAndSortingRepository — adds findAll(Pageable) and findAll(Sort)
  • JpaRepository — extends both, plus flush(), saveAndFlush(), deleteInBatch()
  • Default to JpaRepository unless you have a specific reason not to