Пример #1
1
  public Long getEventsPlayedCount(Sport sport) {

    if (ObjectUtils.isBlank(sport)) {
      return null;
    }

    ObjectType seasonalAthleteType = ObjectType.getInstance(sport.getSeasonalAthleteClass());

    Query<SeasonalAthlete> seasonalAthleteQuery =
        Query.from(SeasonalAthlete.class)
            .where("typeId = ? && athlete = ?", seasonalAthleteType, this);
    return Query.from(Event.class).where("seasonalAthletes = ?", seasonalAthleteQuery).count();
  }
Пример #2
0
  public List<SeasonalAthlete> findSeasonalAthletes(Sport sport) {

    if (ObjectUtils.isBlank(sport)) {
      return null;
    }

    ObjectType seasonalAthleteType = ObjectType.getInstance(sport.getSeasonalAthleteClass());

    return Query.from(SeasonalAthlete.class)
        .where("typeId = ? && athlete = ?", seasonalAthleteType, this)
        .selectAll();
  }