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 Type
    Method
    Description
    boolean
    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, save

    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.mongodb.repository.MongoRepository

    findAll, findAll, insert, insert

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findAllByOrderByCreatedAtDesc

      List<Campaign> findAllByOrderByCreatedAtDesc()
      Finds all campaigns sorted by creation date in descending order.
      Returns:
      List of campaigns sorted by createdAt descending.
    • existsByName

      boolean existsByName(String name)
      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:
      findAll in interface org.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.