For example, is the following top-level JPA class valid:
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name = "type",
discriminatorType = DiscriminatorType.STRING
)
public abstract class Person implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
public Long getId() {
return id;
}
}
Yes, it is perfectly legal. According specification (JPA 2.0) DiscriminatorValue belongs only to concrete entity class.