Interface CampaignRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Campaign,,String> org.springframework.data.repository.ListCrudRepository<Campaign,,String> org.springframework.data.repository.ListPagingAndSortingRepository<Campaign,,String> org.springframework.data.mongodb.repository.MongoRepository<Campaign,,String> org.springframework.data.repository.PagingAndSortingRepository<Campaign,,String> org.springframework.data.repository.query.QueryByExampleExecutor<Campaign>,org.springframework.data.repository.Repository<Campaign,String>
@Repository
public interface CampaignRepository
extends org.springframework.data.mongodb.repository.MongoRepository<Campaign,String>
Repository interface for Campaign entities, providing CRUD operations and
custom query methods.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanexistsByName(String name) Checks if a campaign with the given name already exists.org.springframework.data.domain.Page<Campaign>findAll(org.springframework.data.domain.Pageable pageable) Spring Data will automatically handle the query to fetch only the requested page of data.Finds all campaigns sorted by creation date in descending order.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods 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.mongodb.repository.MongoRepository
findAll, findAll, insert, insertMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findAllByOrderByCreatedAtDesc
Finds all campaigns sorted by creation date in descending order.- Returns:
- List of campaigns sorted by createdAt descending.
-
existsByName
Checks if a campaign with the given name already exists.- Parameters:
name- The name to check for.- Returns:
- true if a campaign with this name exists, false otherwise.
-
findAll
org.springframework.data.domain.Page<Campaign> findAll(org.springframework.data.domain.Pageable pageable) Spring Data will automatically handle the query to fetch only the requested page of data.- Specified by:
findAllin interfaceorg.springframework.data.repository.PagingAndSortingRepository<Campaign,String> - Parameters:
pageable- An object containing pagination and sorting information.- Returns:
- A Page object containing the list of campaigns for the requested page as well as pagination metadata.
-