Discriminator column mapped as entity Hibernate
问题 In hibernate, is it possible to have discriminator as an entity? For example, if I have Department as the base class & AdminDepartment & ProcessingDepartment as subclasses. DepartmentType is the discriminator & is an entity mapped to DEPT_TYPE table. 回答1: Yes, it's possible, though such a relationship will be read-only: @Entity @Inheritence(...) @DiscriminatorColumn(name = "DEPT_TYPE_ID") public class Department { ... @ManyToOne @JoinColumn(name = "DEPT_TYPE_ID", insertable = false, updatable