@Entity
private static class Company implements Serializable {
@Id @GeneratedValue
public long id;
@OneToMany
public Set<Employee> employees;
}
@Entity
@Inheritance( strategy = InheritanceType.TABLE_PER_CLASS )
private static class Employee {
@Id @GeneratedValue
public long id;
@ManyToMany
public Set<Manager> managers;
}
@Entity
private static class Manager extends Employee {
}