Interface ChallengeRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Challenge,Long>, org.springframework.data.jpa.repository.JpaRepository<Challenge,Long>, org.springframework.data.repository.ListCrudRepository<Challenge,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<Challenge,Long>, org.springframework.data.repository.PagingAndSortingRepository<Challenge,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Challenge>, org.springframework.data.repository.Repository<Challenge,Long>

@Repository public interface ChallengeRepository extends org.springframework.data.jpa.repository.JpaRepository<Challenge,Long>
Repository interface that communicates with the data layer relating to the Challenge entity.
Since:
22.4.2024
Version:
1.0
Author:
Yasin M.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.data.domain.Page<Challenge>
    findAllByCompletedOnIsNotNullAndUser(User user, org.springframework.data.domain.Pageable pageable)
    Finds a page of completed saving challenges of a user (completion date is set, therefore not "null")
    Finds a list of active saving challenges of a user (completion date is not set, therefore "null")
    org.springframework.data.domain.Page<Challenge>
    findAllByCompletedOnIsNullAndUser(User user, org.springframework.data.domain.Pageable pageable)
    Finds a page of active saving challenges of a user (completion date is not set, therefore "null")
    Gets an Optional object, wrapped around either a saving challenge of a user, if it exists, or nothing.
    org.springframework.data.domain.Page<Challenge>
    findByUser(User user, org.springframework.data.domain.Pageable pageable)
    Gets a page of saving challenges of a user.

    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.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    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.repository.PagingAndSortingRepository

    findAll

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

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

    • findByUser

      org.springframework.data.domain.Page<Challenge> findByUser(User user, org.springframework.data.domain.Pageable pageable)
      Gets a page of saving challenges of a user.
      Parameters:
      user - User object that owns the challenges
      pageable - Configures the page parameters
      Returns:
      Page of challenges
    • findByIdAndUser

      Optional<Challenge> findByIdAndUser(Long id, User user)
      Gets an Optional object, wrapped around either a saving challenge of a user, if it exists, or nothing.
      Parameters:
      id - Identifies the challenge
      user - The user who owns the challenge
      Returns:
      Optional wrapper around the saving challenge of the user
    • findAllByCompletedOnIsNullAndUser

      org.springframework.data.domain.Page<Challenge> findAllByCompletedOnIsNullAndUser(User user, org.springframework.data.domain.Pageable pageable)
      Finds a page of active saving challenges of a user (completion date is not set, therefore "null")
      Parameters:
      user - User who owns the challenges
      pageable - Configures the page parameters
      Returns:
      Page of active challenges
    • findAllByCompletedOnIsNullAndUser

      List<Challenge> findAllByCompletedOnIsNullAndUser(User user)
      Finds a list of active saving challenges of a user (completion date is not set, therefore "null")
      Parameters:
      user - User who owns the challenges
      Returns:
      List of active challenges
    • findAllByCompletedOnIsNotNullAndUser

      org.springframework.data.domain.Page<Challenge> findAllByCompletedOnIsNotNullAndUser(User user, org.springframework.data.domain.Pageable pageable)
      Finds a page of completed saving challenges of a user (completion date is set, therefore not "null")
      Parameters:
      user - User who owns the challenges
      pageable - Configures the page parameters
      Returns:
      Page of completed challenges