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 提供支持
在本页
  1. javax.persistence Annotations
  2. @OneToOne (bidirectional)

Usage

public interface StudentRepository extends JpaRepository<Student, Long> {
    <T> List<T> findAllBy(Class<T> type);
}
List<Student> studentList = stduentRepository.findAllBy(Student.class);

可以获得一个包含完整 Tuition 对象的 Student 对象。

或者:

public interface TuitionRepository extends JpaRepository<Tuition, Long> {
    <T> List<T> findAllBy(Class<T> type);
}
List<Tuition> tuitionList = tuitionRepository.findAllBy(Tuition.class);

可以获得一个包含完整 Student 对象的 Tuition 对象。

上一页@OneToOne (bidirectional)下一页PO Serialization

最后更新于3年前