Discover a Fast and Easy Way to Implement JPA Repositories Without Any Boilerplate Code

springdatabookcoversmallCreating concrete repositories with the Java Persistence API is a cumbersome process which takes a lot of time and requires a lot of boilerplate code.

There are three reasons for this:

  1. You have to create an abstract base class which provides CRUD operations for entities.
  2. You have to create the concrete repository class which extends your base repository class.
  3. You have to write the code which creates your database queries and executes them.

You might argue that creating the base repository class is not a problem because it is done only once in a project. You are right but think about this:

Every time when you create a database query, you have to write the code which creates and executes it.

This kills your productivity.

But things don’t have to be this way.

Get Rid of Boilerplate Code Once and for All

Spring Data JPA frees you from the slavery of boilerplate code. You can create concrete repositories by creating repository interfaces and letting Spring Data JPA do all the heavy lifting. Because it is capable of providing implementations for your repository interfaces, you can shift your focus from writing boilerplate code to writing code that matters. You can concentrate on creating queries which returns the data you need.

This is a huge time saver!

The first part of the Spring Data book helps you to

  • Configure your repositories without writing a single line of XML.
  • Create new repositories by using only Java interfaces.
  • Execute CRUD operations without adding any code to the repository interfaces.
  • Create database queries by adding query methods to your repository interfaces.
  • Create dynamic queries by using the JPA Criteria API or Querydsl.
  • Sort and paginate your query results without making any changes to the executed query.
  • Extend your repositories with custom methods.

In other words, it helps you to create JPA repositories with less code than ever before.

BONUS: Tweak The Performance of Your Applications With Redis

Redis is a fast key-value store which is a perfect choice when you need fast write and read operations, and your data sets are not larger than memory. You can use it for caching, pub/sub, and showing a list of latest items like comments. Redis is a good choice if you have to move information away from a relational database because the performance of your current solution is not good enough.

Spring Data Redis makes it easy to integrate Redis connector libraries with your Spring powered applications. It hides the connector specific APIs behind a single API which is clean and easy to use.

The second part of the Spring Data book teaches you to

  • Configure the used Redis connector by using Java configuration.
  • Read data from the used Redis instance.
  • Write data to the used Redis instance.
  • Use the Redis publish/subscribe messaging pattern implementation.
  • Utilize the performance of Redis by using it as an implementation of the Spring 3.1 cache abstraction.

This book demonstrates how easy it is to use Redis in your Spring applications.

What Others Are Saying

“Overall, Spring Data from Packt Publishing is a solid book that I recommend to everyone to read.”Mark Serrano

“I will give this book 4 stars out of 5. The book is Brief but take the reader to learn how to use Spring Data using a well crafted and compact application.”Luis Peña

“The book cover well both topics, the code is well written, but have some oddities”Mario Arias

Buy Spring Data

I have read my share of programming books and noticed that many of the them has two common problems:

  • The book is all about theory. This means that it can be hard to apply the theory into practice.
  • The sample code is considered only as a byproduct. The sample projects might be messy and it can be hard to run them.

Spring Data is different. It is a practical hands-on guide and it includes only the theory that is absolutely necessary. As an additional bonus, you receive fully functional example applications that demonstrate the topics covered in this book.

If you looking for a book like this, don’t hesitate to get your copy today!

You can buy Spring Data from