课程: Spring Data 3

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Spring Data CRUDRepository and JpaRepository

Spring Data CRUDRepository and JpaRepository - Spring教程

课程: Spring Data 3

Spring Data CRUDRepository and JpaRepository

- [Instructor] Now let's see how Spring Data JPA gives us better functionality while writing less code. In chapter one, we learned that 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 repository interface with two bounded type parameters. The first parameter, T, is the entity class name. The second parameter, ID, is the type of the unique ID of the entity. The repository interface is just a marker without any methods. Spring Data comments declares a CrudRepository interface. CrudRepository extends from repository and declares methods that create, update, read, and delete entities and inherit the bounded type parameters. List CrudRepository declares more methods that used list collections instead of iterables. JPA repositories extend from list CrudRepository, paging and sorting repository, and query by example executor and adds even more methods…

内容