'List of Entrants not being passed from springboot to react
I have a Tournament and TournamentEntrant Entity. When a member enters a tournament a new TournamentEntrant is created which consists of a Tournament, Member and score
public class TournamentEntrant {
@Id
@ManyToOne
@JoinColumn(name = "member_id", referencedColumnName = "id")
private Member member;
@Id
@ManyToOne
@JoinColumn(name = "tournament_id", referencedColumnName = "id")
private Tournament tournament;
@Column(name = "totalScore")
private double totalScore;
public TournamentEntrant() {
}
public TournamentEntrant(Member member, Tournament tournament, double totalScore) {
this.member = member;
this.tournament = tournament;
this.totalScore = totalScore;
}
}
In the service I am adding the new TournamentEntrant to the list of TournamentEntrant in a Tournament
//Add the current entrant to the list of entrants for this event.
//en being a new TournamentEntrant
entrants.add(en);
t.setTournamentEntrants(entrants);
tournamentEntrantRepo.save(en);
tournamentRepo.save(t);
but when I get a Page of Tournament objects, the TournamentEntrant list isn't returned? I get all the other properties for a tournament.
The TournamentEntrant are there, if I get a Tournament from the db and then get the list of TournamentEnteant and print tournamentEntrant.getmember().getFirstName()` to console in spring, I get the name of the entrant.
I cant understand why they are not being returned to react when I get a Page of Tournaments
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
