From the course: Creating Spring Boot Microservices

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Declare JPA repositories

Declare JPA repositories

- [Instructor] Using just JPA, the next step would be creating services which invoke the entity manager to create read, update, and delete entity objects. Instead, we are going to use Spring Data JPA framework and we'll see how Spring Data JPA gives us better functionality while writing less code. In the last chapter, we chose to include the Spring Data repository dependency, Spring Data abstracts away from any particular data source by following a repository pattern. Now we're actually going to see the implementation of that pattern. Spring Data starts with a Java repository interface with two bounded type parameters. The first type, T, is the entity class name, and the second parameter ID is the type of the unique ID of the entity. The repository interface is just a marker without any methods. Crudrepository is a Spring Data artifact common to many types of data sources. It extends from repository and declares methods that create update, read, and delete entities, which inherit the…

Contents