我有一个像这样的持久性模型:
@Entity
@Table(name="CMM_DT_EMPLOYEE")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "EMP_TYPE")
public abstract class Employee {
@Id
protected Integer employeeId;
...
}
@Entity
@DiscriminatorValue(value = "FULL")
public class FullTimeEmployee extends Employee {
protected Integer salary;
// ...`enter code here`
}
@Entity
@DiscriminatorValue(value = "PART")
public class PartTimeEmployee extends Employee {
protected Float hourlyWage;
}
命名查询(select c from FullTimeEmployee c
)无效。它只返回一行,尽管Employee Table中有许多行用于此鉴别器类型。请帮忙。