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 Type
    Method
    Description
    org.springframework.data.domain.Page<Race>
    findRacesByAthleteId(Long athleteId, org.springframework.data.domain.Pageable pageable)
    Returns a Page of races that have at least one IndividualResult recorded for the athlete with the given athleteId, ordered by their date descending and, as a tiebreaker, by their id descending.

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods 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 a Page of races that have at least one IndividualResult recorded for the athlete with the given athleteId, ordered by their date descending and, as a tiebreaker, by their id descending.
      Parameters:
      athleteId - the ID of the athlete to filter races by
      pageable - the pagination information
      Returns:
      a Page of races for the given athlete, ordered by date and, as a tiebreaker, by id descending