Single Table Per Class Hierarchy with an abstract superclass using Hibernate Annotations
- by Andy Hull
I have a simple class hierarchy, similar to the following:
@Entity
@Table(name="animal")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="animal_type", discriminatorType=DiscriminatorType.STRING)
public abstract class Animal { }
@Entity
@DiscriminatorValue("cat")
public class Cat extends Animal { }
@Entity…