Package org.localify.repositories
Interface FestivalPerformanceRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<FestivalPerformance,,UUID> org.springframework.data.jpa.repository.JpaRepository<FestivalPerformance,,UUID> org.springframework.data.repository.ListCrudRepository<FestivalPerformance,,UUID> org.springframework.data.repository.ListPagingAndSortingRepository<FestivalPerformance,,UUID> org.springframework.data.repository.PagingAndSortingRepository<FestivalPerformance,,UUID> org.springframework.data.repository.query.QueryByExampleExecutor<FestivalPerformance>,org.springframework.data.repository.Repository<FestivalPerformance,UUID>
public interface FestivalPerformanceRepository
extends org.springframework.data.jpa.repository.JpaRepository<FestivalPerformance,UUID>
Repository for
FestivalPerformance entities.-
Method Summary
Modifier and TypeMethodDescriptioncountByFestivalId(UUID festivalId) Counts the number of performances for a festival.voiddeleteByFestivalId(UUID festivalId) Deletes all performances for a festival.findByStageFestivalId(UUID festivalId) Finds all performances for a festival.findByStageFestivalIdAndArtistId(UUID festivalId, UUID artistId) Finds all performances for a festival by a specific artist.findWithNoArtists(UUID festivalId) Finds all performances for a festival that have no artists.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
-
countByFestivalId
@Query("SELECT COUNT(fp) FROM FestivalPerformance fp WHERE fp.stage.festival.id = :festivalId") Integer countByFestivalId(UUID festivalId) Counts the number of performances for a festival.- Parameters:
festivalId- The ID of the festival.- Returns:
- The number of performances.
-
deleteByFestivalId
@Transactional @Modifying @Query("delete from FestivalPerformance fp\nwhere fp.id in (\n select fp.id\n from FestivalPerformance fp\n where fp.stage.festival.id = :festivalId\n)\n") void deleteByFestivalId(UUID festivalId) Deletes all performances for a festival.- Parameters:
festivalId- The ID of the festival.
-
findByStageFestivalId
Finds all performances for a festival.- Parameters:
festivalId- The ID of the festival.- Returns:
- A list of performances.
-
findByStageFestivalIdAndArtistId
@Query("select fp\nfrom FestivalPerformance fp\njoin FestivalPerformanceArtist fpa on fpa.festivalPerformance.id = fp.id\nwhere fp.stage.festival.id = :festivalId\nand fpa.artist.id = :artistId\n") List<FestivalPerformance> findByStageFestivalIdAndArtistId(UUID festivalId, UUID artistId) Finds all performances for a festival by a specific artist.- Parameters:
festivalId- The ID of the festival.artistId- The ID of the artist.- Returns:
- A list of performances.
-
findWithNoArtists
@Query(" select fp\n from FestivalPerformance fp\n where fp.stage.festival.id = :festivalId\n and not exists (\n select 1\n from FestivalPerformanceArtist fpa\n where fpa.festivalPerformance.id = fp.id\n )\n") List<FestivalPerformance> findWithNoArtists(UUID festivalId) Finds all performances for a festival that have no artists.- Parameters:
festivalId- The ID of the festival.- Returns:
- A list of performances.
-