我有这两个实现单表继承策略的类:
@Entity
@Table(name = "tableA")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "type")
@DiscriminatorValue("A")
class A {
...
}
@Entity
@DiscriminatorColumn(name = "type")
@DiscriminatorValue("B")
class B extends A {
...
}
当我创建一个查询来获取所有 A 实体时,它也会给我带来 B 实体。如何仅获取 A 类型的实体?