Basic knowledge of SPRING-DATA-JPA repository

Source: Internet
Author: User

1. Use of repository objects in the project

2.Repository introduced in two ways

Inheritance and use annotations

Definition of the 3.Repository interface

The Repository interface is a core interface of Spring Data and does not provide any methods, and developers need to declare the required methods in their own defined interfaces.

public interface Repository<T, ID extends Serializable> { } 

Hierarchical relationship of 4.Repository interfaces

The underlying Repository provides the most basic data access functionality, and several of its sub-interfaces extend functionality. Their inheritance relationships are as follows:
Repository: Just an identity, indicating that any inherited it is a warehouse interface class
(1) Crudrepository: Inherit Repository, implement a set of CRUD related methods
(2) Pagingandsortingrepository: Inherit crudrepository, realize a component page sort related method
(3) Jparepository: Inheriting pagingandsortingrepository, implementing a set of JPA specification-related methods

The custom xxxxrepository needs to inherit the jparepository, so the Xxxxrepository interface has the capability of a common data access control layer.

Jpaspecificationexecutor: Does not belong to the repository system, implements a set of JPA Criteria query related methods.

Basic knowledge of SPRING-DATA-JPA repository

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.