Databases Reference
In-Depth Information
We will use the Querydsl example application created in Chapter 3, Building Queries
with Spring Data JPA , as a starting point. Let's first refresh our memory and spend a
moment to review the structure of our example application. Our service layer consists
of a single class called RepositoryPersonService that uses our repository interface
called ContactRepository . The pagination and query building logic of our application
is located at the service layer. This situation is illustrated in the following diagram:
Adding custom functionality to a single
repository
The ability to add custom functionality to a single repository is a useful feature when
the added functionality is related only to a single entity. In this section, we will
investigate how this can be done, and move the pagination and search logic from the
service layer to the repository layer.
If we want to add custom functionality to a single repository, we have to follow the
following steps:
1.
Create a custom interface that declares the custom methods.
2.
Implement the created interface.
3.
Create a repository interface.
4.
Create a service implementation that uses the custom functionality.
 
Search WWH ::




Custom Search