Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Hibernate中使用不同的资源字段作为筛选器_Hibernate_Jpa_Spring Data Jpa - Fatal编程技术网

如何在Hibernate中使用不同的资源字段作为筛选器

如何在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

我有两个实体(比如a和B)。。现在我想使用资源B中定义的字段作为资源a中的过滤器。我该如何做

资源A }

资源B }

现在我想使用资源B的“product”字段作为资源a中的过滤器,就像下面来自postman的一样。我怎么用呢

http://localhost:8080/A?Filter[产品]=“测试”

注:-typeId列在这两个实体中是通用的(typeId是实体B中的主键)

@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;