Hibernate Annotations – Mapping Inheritance
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name=”planetype”,
discriminatorType=DiscriminatorType.STRING
)
@DiscriminatorValue(”Plane”)
public class Plane { … }@Entity
@DiscriminatorValue(”A320″)
public class A320 extends Plane { … }
is different from
@MappedSuperclass
public class BaseEntity {
@Basic
@Temporal(TemporalType.TIMESTAMP)
public Date getLastUpdate() { … }
public String getLastUpdater() { … }
…
}@Entity class Order extends BaseEntity {
@Id public Integer getId() { … }
…
}
