@Override
  public ArrayList<Goal> getToreByTeam(Team team, Matches match) {
    ArrayList<Goal> rc = new ArrayList<>();

    for (Goal g :
        (ArrayList<Goal>)
            em.createNativeQuery("select * from goal where match_Id = " + match.getId(), Goal.class)
                .getResultList()) {

      if (team.getPlayerList().contains(g.getPlayerId())) {
        rc.add(g);
      }
    }

    return rc;
  }
  /*
  int[][] -> erstes Feld ist für die Heimmanschaft und zweites Feld für Auswärtsteam
  die jeweils vier Felder stehen für die Punkte, tore, Gegentore und das Torverhältnis
  */
  @Override
  public int[][] getWerteMatchAus(Matches match) {

    int[][] rc = new int[2][4];
    Team heim = match.getHeimteam();
    ArrayList<Goal> goalList =
        (ArrayList<Goal>)
            em.createNativeQuery("select * from goal where match_id = " + match.getId(), Goal.class)
                .getResultList();

    for (Goal goal : goalList) {

      if (heim.getPlayerList().contains(goal.getPlayerId())) {

        rc[0][1] += 1;
        rc[1][2] += 1; // Gegentor für die Auswärtsmannschaft
      } else {

        rc[1][1] += 1;
        rc[0][2] += 1; // Gegentor für die Heimmannschaft
      }
    }

    if (rc[0][1] > rc[1][1]) { // Sieg Heimmanschaft
      rc[0][0] += 3;

    } else if (rc[0][1] < rc[1][1]) { // Sieg Auswärtsmannschaft
      rc[1][0] += +3;
    } else { // Unentschieden
      rc[0][0] += 1;
      rc[1][0] += 1;
    }

    rc[0][3] = rc[0][1] - rc[0][2];
    rc[1][3] = rc[1][1] - rc[1][2];

    return rc;
  }