How delete object in one side at bidirectional relation?
You can achieve this more simply by doing the below:
public void deletePlayerFromTeam(int idPlayer){
Player player = //loadPlayer;
player.setTeam(null);
playerRepository.save(player);
}
You can also achieve this in your original code by setting the player.team to null and and by setting cascade on the collection to merge:
@OneToMany(mappedBy = "team", fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
private List<Player> playerList;
You should always ensure both sides of the relationship are maintained consistently.