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 TypeMethodDescriptionfindByEarnedBy_Id(Integer athleteId) Finds all badges earned by the specified athlete.findByIdNotIn(List<Integer> ids) Finds all badges whose identifiers are not in the provided list.findBySportId(Integer sportId) 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, 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
-
findBySportId
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
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
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
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
-