Spring Data JPA Tutorial

Creating repositories that use the Java Persistence API is a cumbersome process that takes a lot of time and requires a lot of boilerplate code.

We can remove some boilerplate code by creating an abstract base repository class that provides CRUD operations for our entities. This means that we can create concrete repositories by extending that base repository class. In other words, we have to write the code that provides CRUD operations only once.

The problem is that this does not eliminate all boilerplate code. We still have write the code that creates our database queries and invokes them. To make matters worse, we have to do this every time when we create a new database query.

This is a waste of time!

Spring Data JPA was created to solve this problem.

Introducing: Spring Data JPA Tutorial

This tutorial describes how you can create JPA repositories without writing any boilerplate code, and it consists of the following blog posts

The following blog posts belong to my "old" Spring Data JPA tutorial and use Spring Data JPA 1.2.0:

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.

Additional Reading:

  • My Spring Data book helps you to create JPA repositories without any boilerplate code and tweak the performance of your applications with Spring Data Redis.
  • Spring Data Solr Tutorial describes how you can implement fast search functions with Spring Data Solr.
  • Using jOOQ with Spring helps you to get back in control of your SQL. If you are tired of solving ORM related performance problems, you should do yourself a favor and read this tutorial.

Other Resources

This section showcases useful material created by other developers. If you have written a blog post or recorded a video about Spring Data JPA, and want to include it to this section, ping me on Twitter and I will check it out. If I think that it is useful, I will add it to this section.

Java Persistence API

Reference Manuals and Official Guides

Blog Posts


Spring Data JPA

Reference Manuals and Official Guides

Blog Posts