Package org.localify.repositories
Interface FestivalRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Festival,,UUID> org.springframework.data.jpa.repository.JpaRepository<Festival,,UUID> org.springframework.data.repository.ListCrudRepository<Festival,,UUID> org.springframework.data.repository.ListPagingAndSortingRepository<Festival,,UUID> org.springframework.data.repository.PagingAndSortingRepository<Festival,,UUID> org.springframework.data.repository.query.QueryByExampleExecutor<Festival>,org.springframework.data.repository.Repository<Festival,UUID>
@Repository
public interface FestivalRepository
extends org.springframework.data.jpa.repository.JpaRepository<Festival,UUID>
Repository for
Festival entities.-
Method Summary
Modifier and TypeMethodDescriptionfindByNameAndYear(String name, int yr) Finds a festival by name and year.Finds festivals by name, ignoring case.findNearbyFestivals(org.locationtech.jts.geom.Point point, Double radius) Finds festivals near a geographic point.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
-
findByNameAndYear
@Query(value="select * from festivals f where f.name = :name AND date_part(\'year\', f.start_date) = :yr", nativeQuery=true) Optional<Festival> findByNameAndYear(String name, int yr) Finds a festival by name and year.- Parameters:
name- The name of the festival.yr- The year of the festival.- Returns:
- An optional containing the festival if found, otherwise empty.
-
findNearbyFestivals
@Query("select f from Festival f where st_distance(st_transform(f.geoPoint, 3857), st_transform(:point, 3857)) <= (:radius * 1000.0)") List<Festival> findNearbyFestivals(org.locationtech.jts.geom.Point point, Double radius) Finds festivals near a geographic point.- Parameters:
point- The geographic point.radius- The search radius in kilometers.- Returns:
- A list of festivals.
-
findByNameContainingIgnoreCase
Finds festivals by name, ignoring case.- Parameters:
name- The name to search for.- Returns:
- A list of festivals.
-