简体   繁体   English

如何在 R2DBC 和 Spring WebFlux 中加入多个表?

[英]How to Join multple table in R2DBC and Spring WebFlux?

//1. //1. Person Entity个人实体

class Person {
    private Integer id;
    private String name;
    Private Address addId;
}

//2. //2。 Address Entity地址实体

class Address {
    private Integer addId;
    private String city;
    Private String state;
    Private String country;
    Private Integer zip;  
}
  1. How to Join multple table in R2DBC and Spring WebFlux?如何在 R2DBC 和 Spring WebFlux 中加入多个表?

Currently R2DBC doesnt support annotation such as @OneToMany.目前 R2DBC 不支持 @OneToMany 等注解。 So in Address you shuld have a property called userId of type Integer and pertsist Person and then persist Address.因此,在 Address 中,您应该有一个名为 userId 的 Integer 类型的属性,并坚持 Person,然后坚持 Address。 And to get them you should first get the Person and find the Address by the userId要获取它们,您应该首先获取 Person 并通过 userId 找到地址

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM