I am working on JPA project and I need your help.
I have two classes, “Person” and “Leader” which inherits from Person.
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Person implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(unique = true)
private String personId;
}
And
@Entity
public class Leader extends Person implements Serializable {
private List < Person > listTeam;
public void addPersonInTeam(Person e) {
listTeam.add(e);
}
}
My question Is, do I need to have JPA annotations @OneToMany or something else before private List listTeam in class Leader?
Thank you very much