JPA Default Methods #83
pwgit-create
announced in
File-Integrity-Database
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Here are the default methods available in some common repository interfaces:
CrudRepository
CrudRepositoryprovides basic CRUD functionality.Default Methods in
CrudRepositorySave
Find One
Exists By Id
Count
Delete By Id
Delete Entity
Find All
Find All (Iterable)
PagingAndSortingRepository
PagingAndSortingRepositoryextendsCrudRepositoryand adds methods to retrieve entities using pagination andsorting.
Additional Methods in
PagingAndSortingRepositoryFind All (Pageable)
Find All (Sort)
JpaRepository
JpaRepositoryextendsPagingAndSortingRepositoryand adds additional methods that are helpful for JPA-specificoperations, like batch deletions.
Additional Methods in
JpaRepositorySave All
Flush
Delete In Batch
Delete All In Batch
Get One
Example Repository Interface
Here's an example of how you might define a
UserRepositoryinterface without any custom query methods:By extending
JpaRepository, yourUserRepositorywill automatically have all the CRUD operations provided byCrudRepository,PagingAndSortingRepository, and additional JPA-specific methods.Beta Was this translation helpful? Give feedback.
All reactions