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 @MappedSuperClass上的JPA查询。获取所有子类的详细信息?_Hibernate_Jpa_Spring Boot_Spring Hateoas - Fatal编程技术网

Hibernate @MappedSuperClass上的JPA查询。获取所有子类的详细信息?

Hibernate @MappedSuperClass上的JPA查询。获取所有子类的详细信息?,hibernate,jpa,spring-boot,spring-hateoas,Hibernate,Jpa,Spring Boot,Spring Hateoas,我有三个单选按钮1.汽车,2.自行车,3.两者都有。所以如果我选择 如果我选择2,它将获取所有汽车详细信息 获取汽车详细信息,直到我能够实现,但如何 如果我选择第三个单选按钮,则获取汽车和自行车的详细信息 二者都在下面的示例中,我希望在选择两者时执行相同的操作 它将获取所有文件。这方面的最佳解决方案是什么 Parent class: @MappedSuperclass public abstract class BaseProsecutionDocument {

我有三个单选按钮1.汽车,2.自行车,3.两者都有。所以如果我选择 如果我选择2,它将获取所有汽车详细信息 获取汽车详细信息,直到我能够实现,但如何 如果我选择第三个单选按钮,则获取汽车和自行车的详细信息 二者都在下面的示例中,我希望在选择两者时执行相同的操作 它将获取所有文件。这方面的最佳解决方案是什么

    Parent class:
    @MappedSuperclass
    public abstract class BaseProsecutionDocument {

    private long dmsDocumentId;
    private long documentVersion;
    private String fileName;
    …
    }

    Pros class:

    @Entity
    @Table(schema = “reference”, name = “prosecution_documents”)
    public class ProsDocument extends BaseProsecutionDocument {

    private Long id;
    private Long prosId;
    private Long ocportalSubmissionId;
    …
    }

    Sumisiion class:

    @Entity
    @Immutable
    @Table(schema = “reference”, name = “submission_docs”)
    public class submissionDocument extends BaseProsecutionDocument {

    private Long id;
    private Long inventionId;
    …
    }
    I want to know how to write the query for that..like
    i have written for those 2 radio buttons:

    public interface ProsecutionDocumentRepository extends JpaRepository {
    @Query(value = “SELECT ppd FROM ProsDocument ppd ” +
    “WHERE ppd.submissionId IN (SELECT p.id FROM submission p WHERE 
UPPER(p.doc) = UPPER(:doc)) ” +
    “AND ppd.documentType.documentType in (‘OFFICE’)”)
    Page findSubmissionOfficeDocumentsByDoc(@Param(“doc”) String docket, 
Pageable pageable);
    }
或者我需要将@MappedSuperClass更改为@Entity并使用它吗 @InheritanceFosterategy=InheritanceType.JOINED

首先用基本字段创建一个基类

@MappedSuperclass
public class FooBase {

@Id
private Long id;
private String name;

}
将该类映射到空类上的表

@Entity
@Table(name = "foo")
public class Foo  extends FooBase{

}
将嵌套对象、集合和子资源映射到另一个类上但相同的表foo

@Entity
@Table(name = "foo")
public class FooNested extends FooBase {

    @Fetch(FetchMode.SUBSELECT)
    @OneToMany(fetch = FetchType.EAGER)
    @JoinColumn(name = "foo_id", insertable = false, updatable = false)
    @ApiModelProperty(hidden = true)
    private List<Bar> barList;
    }
为每个实体创建一个Reporitory

使用一个或其他存储库来获取或不获取实时表/实体