如何在Hibernate中使用不同的资源字段作为筛选器
我有两个实体(比如a和B)。。现在我想使用资源B中定义的字段作为资源a中的过滤器。我该如何做 资源A } 资源B } 现在我想使用资源B的“product”字段作为资源a中的过滤器,就像下面来自postman的一样。我怎么用呢 http://localhost:8080/A?Filter[产品]=“测试” 注:-typeId列在这两个实体中是通用的(typeId是实体B中的主键)如何在Hibernate中使用不同的资源字段作为筛选器,hibernate,jpa,spring-data-jpa,Hibernate,Jpa,Spring Data Jpa,我有两个实体(比如a和B)。。现在我想使用资源B中定义的字段作为资源a中的过滤器。我该如何做 资源A } 资源B } 现在我想使用资源B的“product”字段作为资源a中的过滤器,就像下面来自postman的一样。我怎么用呢 http://localhost:8080/A?Filter[产品]=“测试” 注:-typeId列在这两个实体中是通用的(typeId是实体B中的主键) @JsonApiResource(type = "A") @Entity(name = &quo
@JsonApiResource(type = "A")
@Entity(name = "test")
@Data // Lombok
public class Test{
@JsonApiId
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@JsonApiField(filterable = true, sortable = true)
private Long Id;
@JsonApiField(filterable = true, sortable = true)
private Long typeId;
@JsonApiField(filterable = true, sortable = true)
private String name;
@JsonApiResource(type = "B", readable = true, patchable = false, deletable = false, postable = false,
filterable = false, sortable = false)
@Entity(name = "TestB")
@Getter
@Setter
public class TestB{
@JsonApiId
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@JsonApiField(sortable = true, filterable = true)
private Long typeId;
@JsonApiField(sortable = true, filterable = true)
private String category;
@JsonApiField(sortable = true, filterable = true)
private String product;