我有以下实体:
@Table(name="Animal")
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorValue("Animal")
public class Animal{
// code brevity
}
@Entity
@Discriminatorvalue("Dog")
public class Dog extends Animal{
// code brevity
}
因此,当我运行jpa查询entityManager.createQuery(“ from Animal”)。getResultList()时,它将返回我Animal表where DTYPE in('Animal','Dog') 代替where DTYPE in('Animal')] >>。如何获得仅返回[[其中DYTPE ='Animal'的记录?
我有以下实体:@Table(name =“ Animal”)@Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE)@DiscriminatorValue(“ Animal”)公共类Animal {//代码简洁性} @Entity @ ...] >from Animal
表示Animal类型的实例。类型为[[Dog