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(); }
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(); }