Spring系列:JPA之JpaRepository接口
public interface JpaRepository<T, ID>
extends PagingAndSortingRepository<T, ID>, QueryByExampleExecutor<T>
- 可以看出JpaRepository继承了接口PagingAndSortingRepository和QueryByExampleExecutor。而PagingAndSortingRepository又继承CrudRepository。因此,JpaRepository接口同时拥有了基本CRUD功能以及分页功能
- 当我们需要定义自己的Repository的时候,我们可以继承JpaRepository,从而获得Spring为我们预先定义的多种基本数据操作方法。JpaRepository提供的方法: