@Entity
@Inheritance
@DiscriminatorColumn(name = "art", length = 1)
public abstract class AbstractKunde implements Serializable {
@Id
@GeneratedValue
@Basic(optional = false)
private Long id;
@OneToOne(mappedBy = "kunde", cascade = { PERSIST, REMOVE })
@NotNull(message = "{...")
private Adresse adresse;
@OneToMany
@JoinColumn(name = "kunde_fk", nullable = false)
@OrderColumn(name = "idx", nullable = false)
private List<Bestellung> bestellungen;
...
}
@Entity
@Inheritance
@DiscriminatorValue("F")
@Cacheable
public class Firmenkunde extends AbstractKunde {...}