Mapping multi-Level inheritance in Hibernate with Annotations

前端 未结 3 1639
广开言路
广开言路 2020-12-15 13:40

Take the situation listed in this question:

Mapping multi-Level inheritance in Hibernate

How would this mapping be done with Annotations rather than an hbm f

3条回答
  •  死守一世寂寞
    2020-12-15 14:14

    Inheritance between @Entity annotated classes is picked up automatically. So if you class A is annotated and class B is also annotated with @Entity and extends A, and C extends B and is also @Entity annotated all will be picked up.

    I have not used joined subclasses combined with discriminator values, but I'm sure it will be very similar to what is done in XML (using @DiscriminatorColumn and @DiscriminatorValue)

提交回复
热议问题