Spring Data JPA中CrudRepository和JpaRepository的区别

CrudRepositoryJpaRepository 的区别!

原文地址,转载备份

JpaRepository extends PagingAndSortingRepository which in turn extends CrudRepository.

Their main functions are:

CrudRepository mainly provides CRUD functions.
PagingAndSortingRepository provides methods to do pagination and sorting records.
JpaRepository provides some JPA-related methods such as flushing the persistence context and deleting records in a batch.

Because of the inheritance mentioned above, JpaRepository will have all the functions of CrudRepository and PagingAndSortingRepository. So if you don’t need the repository to have the functions provided by JpaRepository and PagingAndSortingRepository , use CrudRepository.

猜你喜欢

转载自blog.csdn.net/qq_45796667/article/details/131210425