Interface IndividualResultRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<IndividualResult,,Long> org.springframework.data.jpa.repository.JpaRepository<@NonNull IndividualResult,,@NonNull Long> org.springframework.data.repository.ListCrudRepository<IndividualResult,,Long> org.springframework.data.repository.ListPagingAndSortingRepository<IndividualResult,,Long> org.springframework.data.repository.PagingAndSortingRepository<IndividualResult,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<IndividualResult>,org.springframework.data.repository.Repository<IndividualResult,Long>
@Repository
public interface IndividualResultRepository
extends org.springframework.data.jpa.repository.JpaRepository<@NonNull IndividualResult,@NonNull Long>
The
IndividualResultRepository provides database access for IndividualResult
entities.-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.data.domain.Page<Race> findRacesByAthleteId(Long athleteId, org.springframework.data.domain.Pageable pageable) Returns aPageofracesthat have at least oneIndividualResultrecorded for the athlete with the givenathleteId, ordered by theirdatedescending and, as a tiebreaker, by theiriddescending.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findRacesByAthleteId
@Query(value="SELECT DISTINCT r FROM Race r LEFT JOIN FETCH r.courses c LEFT JOIN FETCH c.event e WHERE EXISTS ( SELECT 1 FROM IndividualResult ir WHERE ir.race = r AND ir.athlete.id = :athleteId) ORDER BY r.date DESC, r.id DESC", countQuery="SELECT COUNT(DISTINCT r) FROM Race r WHERE EXISTS ( SELECT 1 FROM IndividualResult ir WHERE ir.race = r AND ir.athlete.id = :athleteId)") org.springframework.data.domain.Page<Race> findRacesByAthleteId(@Param("athleteId") Long athleteId, org.springframework.data.domain.Pageable pageable) Returns aPageofracesthat have at least oneIndividualResultrecorded for the athlete with the givenathleteId, ordered by theirdatedescending and, as a tiebreaker, by theiriddescending.- Parameters:
athleteId- the ID of the athlete to filter races bypageable- the pagination information- Returns:
- a
Pageofracesfor the given athlete, ordered by date and, as a tiebreaker, by id descending
-