The Spring Boot Data JPA provides a CrudRepository interface for CRUD operations. It provides CRUD functionalities to our entity class.
We will now create our repository in the domain package, as follows:
- Create a new class called CarRepository in the domain package and modify the file according to the following code snippet:
package com.packt.cardatabase.domain; import org.springframework.data.repository.CrudRepository; public interface CarRepository extends CrudRepository <Car, Long> { }
Our CarRepository now extends the Spring Boot JPA CrudRepository interface. <Car, Long> type arguments define that this is the repository for the Car entity class and the type of the ID field is long.
CrudRepository provides ...