Adding the JPA repositories in the CMS application

Once the whole infrastructure and JPA mappings are done, we can add our repositories to our projects. In the Spring Data project, there are some abstractions, such as Repository, CrudRepository, and JpaRepository. We will use the JpaRepository because it supports the paging and sorting features.

Our repository will be pretty simple. There are a couple of standard methods, such as save(), update(), and delete(), and we will take a look at some DSL query methods which allow developers to create custom queries based on attribute names. We created an AbstractRepository to help us to store the objects in memory. It is not necessary anymore. We can remove it.

Let's create our first JPA repository: ...

Get Spring 5.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.