我有一个抽象类:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class A {
...
}
还有一些扩展类,比如:
@Entity
public class B extends A {
...
}
我也有第三个实体:
@Entity
public class C {
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
private A objectA;
...
}
问题是,我如何在C实体仓库中构建Spring Data JPA finder,以查询仅具有所需类型的A扩展对象?
select s from Sample s where TYPE(s) = :type
。 - MariuszS