This article is a mirror article of machine translation, please click here to jump to the original article.

View: 32466|Reply: 0

[Source] Difference between CrudRepository and JpaRepository in Spring Data JPA

[Copy link]
Posted on 5/26/2021 5:59:52 PM | | | |
Benefits of using Spring Data JPA CrudRepository and JpaRepository:

Inheriting these interfaces allows Spring to find customized database operation interfaces and generate proxy classes, which can be injected into Spring containers in the future.

You can not write related SQL operations and generate them by proxy classes

They have an inheritance relationship:

PagingAndSortingRepository inherits from CrudRepository
JpaRepository inherits PagingAndSortingRepository


In other words, CrudRepository provides basic additions, deletions, and corrections; PagingAndSortingRepository provides pagination and sorting methods; JpaRepository provides the methods JPA needs.

When using it, you can choose which interface to inherit according to your specific needs.





Previous:The difference between spring-boot-starter-data-redis and spring-boot-starter-redis is the same
Next:class xx cannot access a member of class xx with modifiers "private"
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com