The difference between 004 JpaRepository, CrudRepository, PagingAndSortingRepository of

  Many programs are in use, CrudRepository or PagingAndSortingRepository, but before their own procedures using JpaRepository, then checked the material, record it.

1. FIG class

  

 

2. Description

  CrudRepository and PagingAndSortingRepository provided by Spring Data;

  JpaRepository provided by Spring Data JPA, and Spring Data JPA is a sub-project of the Spring Data, which is the relationship between the two.

  In general, the best idea is to use CrudRepository or PagingAndSortingRepository, depending on whether sorting and paging. If possible, you should avoid using JpaRepository, because it will contact the repository and JPA persistence technology together, and in most cases, we may not even use additional methods it provides.

3. Pack

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.CrudRepository;

 

Guess you like

Origin www.cnblogs.com/juncaoit/p/11225875.html