Spring Data JPA Quick Guide
  • Spring Data JPA 快速指南
  • 配置依赖
  • 配置数据源
  • 数据库编码与词语定序
  • Core Concepts
  • 基本用法
  • Transactions
    • 什么是事务
    • 配置事务(@EnableTransactionManagement)
    • 配置事务(XML)
    • 配置事务(@Transactional)
    • @Transactional 实现细节
    • Transaction and Spring Data JPA
    • 事务隔离
    • 事务传播
  • Query Creation from Method Names
  • Using @Query
  • Sorting and Pagination
  • Projection
  • Specification
  • Query by Example
  • javax.persistence Annotations
    • @OneToOne (bidirectional)
      • Usage
      • PO Serialization
      • Save and Update
      • Nested Projection
      • @MapsId
    • @OneToMany (bidirectional)
    • @OneToMany (unidirectional)
    • @ManyToMany (bidirectional)
      • Many-to-Many Using a Composite Key
由 GitBook 提供支持
在本页

Core Concepts

学习 Spring Data JPA 的核心概念

上一页数据库编码与词语定序下一页基本用法

最后更新于3年前

The central interface in the Spring Data repository abstraction is Repository. It takes the domain class to manage as well as the ID type of the domain class as type arguments. This interface acts primarily as a marker interface to capture the types to work with and to help you to discover interfaces that extend this one. The CrudRepository interface provides sophisticated CRUD functionality for the entity class that is being managed.

Repository 提供最基本的支持,不包含任何预定义方法。

CrudRepository 预定义了基本的 CRUD 方法。

PagingAndSortingRepository 预定义了分页和排序的功能。

QueryByExampleExecutor 使得继承了该接口的 Repository 具有 Query by Example 的功能。

派生关系如下:

Repository 的派生关系

所以,如果没有特殊需求,想要方便地使用 Spring Data JPA 提供的最多功能,使用 JpaRepository 即可。