Databases Reference
In-Depth Information
Building Queries with Spring
Data JPA
We have learned how we can configure Spring Data JPA and implemented a simple
CRUD application. Now it is time that we learn some skills that will help us to
implement real-life applications. In this chapter, we will cover:
• How we can use query methods for creating queries
• How we can create dynamic queries by using the JPA Criteria API
• How we can use Querydsl for creating dynamic queries
• How we can sort and paginate query results
In the course of this chapter, we will extend our contact manager application by
adding a search function to it. The requirements of the search function are as follows:
• The search function must return all contacts whose first name or last name
start with the given search term
• The search must be case insensitive
• The search results must be sorted in ascending order by using the last name
and first name
• The search function must be able to paginate search results
We will also learn to sort and paginate the contact list shown on the home page of
our application.