import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.OrderBy; import java.util.ArrayList; import java.util.Date; import java.util.List; @Entity public class Person { @Id private Long id; private Date birthDate; @ManyToOne private Person mother; @ManyToOne private Person father; @OneToMany(mappedBy = "id") @OrderBy("birthDate asc") private List children = new ArrayList<>(); }