Interface BadgeRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Badge,Integer>, org.springframework.data.jpa.repository.JpaRepository<Badge,Integer>, org.springframework.data.repository.ListCrudRepository<Badge,Integer>, org.springframework.data.repository.ListPagingAndSortingRepository<Badge,Integer>, org.springframework.data.repository.PagingAndSortingRepository<Badge,Integer>, org.springframework.data.repository.query.QueryByExampleExecutor<Badge>, org.springframework.data.repository.Repository<Badge,Integer>

@Repository public interface BadgeRepository extends org.springframework.data.jpa.repository.JpaRepository<Badge,Integer>
Spring Data JPA repository for Badge entities.

Provides standard CRUD operations as well as custom query methods for retrieving badges by sport, by earning athlete, or excluding specific identifiers.

Author:
SportTrack Team
  • Method Summary

    Modifier and Type
    Method
    Description
    Finds all badges earned by the specified athlete.
    Finds all badges whose identifiers are not in the provided list.
    Finds all badges associated with the specified sport.
    Finds all badges with no sport assigned (universal badges that apply to all sports).

    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

    • findBySportId

      List<Badge> findBySportId(Integer sportId)
      Finds all badges associated with the specified sport.
      Parameters:
      sportId - the unique identifier of the sport
      Returns:
      a list of badges linked to the given sport
    • findBySportIsNull

      List<Badge> findBySportIsNull()
      Finds all badges with no sport assigned (universal badges that apply to all sports).
      Returns:
      a list of badges with sport field null
    • findByEarnedBy_Id

      List<Badge> findByEarnedBy_Id(Integer athleteId)
      Finds all badges earned by the specified athlete.
      Parameters:
      athleteId - the unique identifier of the athlete
      Returns:
      a list of badges earned by the athlete
    • findByIdNotIn

      List<Badge> findByIdNotIn(List<Integer> ids)
      Finds all badges whose identifiers are not in the provided list.
      Parameters:
      ids - the list of badge identifiers to exclude
      Returns:
      a list of badges not matching any of the given identifiers