Spring Data Repository
Learn the use of the spring data repository to implement a ready-made persistence tier with almost no code.
Objective
In the previous chapter, we have designed a persistence layer using generic & abstract DAO.
This article will focus on designing a persistence layer using Spring Data JPA.
Introduction
As we discussed in a previous lesson, designing a persistence layer with abstract DAO requires us to write some amount of boilerplate code. It is found that this pattern is used in every project. Why not provide such a programming model as part of the framework?
The capability is provided by Springdata, which makes it possible to remove the DAO implementations entirely.
To leverage the Spring Data programming model with JPA, our repository should extend one of the available Spring Data JPA repository interfaces. By extending the interface, we can perform basic CRUD operations and more without even writing a single line of code.
Isn’t that awesome?
Let’s enhance our old-school Billionaire’s Club application to utilize ...