The answer to is question is yes even if the only thing you have to is to execute a simple database query. If you have to write dynamic queries or implement pagination, the situation is much much worse.
The goal of the Spring Data JPA is to make the implementation of data access layer easier and faster. At this point, you might be asking yourself, if this problem can really be solved by introducing a new layer of abstraction. I can assure to you that I too had my doubts about it when I first heard about Spring Data JPA.
However, I kept an open mind and tried it out myself. I ask you to do the same and find out how easy (and fun) implementing data access code can be.
Introducing: Spring Data JPA Tutorial
This nine-part tutorial will help you to get started with Spring Data JPA. This tutorial is based on Spring Data JPA 1.0.2 but its information is also valid for newer versions of Spring Data JPA. On the other hand, if you are interested of reading about Spring Data JPA 1.2.0, you can start by taking a look at my Spring Data book.
Lets move on and find out what you can learn by reading this tutorial.
- Spring Data JPA Tutorial, Part One: Configuration describes how you can get the required dependencies with Maven and configure your application.
- Spring Data JPA Tutorial, Part Two: CRUD helps you to implement a simple CRUD application by using Spring Data JPA.
- Spring Data JPA Tutorial, Part Three: Custom Queries with Query Methods describes how you can create custom queries by adding query methods to your repository interfaces.
- Spring Data JPA Tutorial, Part Four: JPA Criteria Queries teaches you to create dynamic queries by using the JPA Criteria API.
- Spring Data JPA Tutorial, Part Five: Querydsl describes how you can create custom queries with Querydsl and Spring Data JPA.
- Spring Data JPA Tutorial, Part Six: Sorting describes how you can sort your query results.
- Spring Data JPA Tutorial, Part Seven: Pagination helps you to paginate your query results.
- Spring Data JPA Tutorial, Part Eight: Adding Functionality to a Repository describes how you can add custom functions to a single repository.
- Spring Data JPA Tutorial, Part Nine: Conclusions evaluates the usefulness of Spring Data JPA, gives recommendations about its usage and provides links to useful resources.
Congratulations. If you read every part of this tutorial, you know that implementing data access code does not have to be cumbersome. It can be fast, simple and fun.
It is time to put your new skills to use.
P.S. If you liked my Spring Data JPA tutorial, take a look at my Spring Data book.