1

I am learning Spring boot. In the DAO interface, i see some documents use CrudRepository, some use JpaRepository, some others use a Custom Generic interface.

In which case should i use CrudRepository, JpaRepository or the custom one.

here is an example of the interface

@Repository
public interface EmployeeRepository extends CrudRepository<Employee, Long> {  }
Girbson BIJOU
  • 475
  • 1
  • 4
  • 9
  • `JpaRepository` is a `CrudRepository` but with some additional JPA specific methods on it. If you don't need those JPA specific methods, then use `CrudRepository` else use `JpaRepository`. – M. Deinum Jul 08 '21 at 13:37
  • 1
    Does [What is difference between CrudRepository and JpaRepository interfaces in Spring Data JPA?](https://stackoverflow.com/questions/14014086/what-is-difference-between-crudrepository-and-jparepository-interfaces-in-spring) help you? – J.F. Jul 08 '21 at 13:39

0 Answers0