@Entity
public class Member{
@ManyToOne
@JoinColumn(name="TEAM_ID")
private Team team;
}
@Entity
public class Team{
@OneToMany(mappedBy="team")
private List<Member> members = new ArrayList<>();
}
@Entity
public class Member{
public void changeTeam(Team team){
this.team=team;
team.getMembers().add(this)
}
}