Interface PollVoteDAO

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

public interface PollVoteDAO extends org.springframework.data.jpa.repository.JpaRepository<PollVoteEntity,Long>
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    countByPollId(long pollId)
     
    long
    countByPollIdAndVoterId(Long pollId, long userId)
     
    int
    countByPollOptionId(long pollOptionId)
     
    int
    countByPollOptionIdAndVoterId(long pollOptionId, long userId)
     

    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

    • countByPollOptionId

      int countByPollOptionId(long pollOptionId)
    • countByPollOptionIdAndVoterId

      @Query(" SELECT COUNT(pv) FROM PollVote pv\n WHERE pv.pollOption.id = ?1\n AND pv.voterId = ?2\n") int countByPollOptionIdAndVoterId(long pollOptionId, long userId)
    • countByPollId

      @Query(" SELECT COUNT(pv) FROM PollVote pv\n INNER JOIN pv.pollOption po ON po.poll.id = ?1\n") int countByPollId(long pollId)
    • countByPollIdAndVoterId

      @Query(" SELECT COUNT(pv) FROM PollVote pv\n INNER JOIN pv.pollOption po ON po.poll.id = ?1\n WHERE pv.voterId = ?2\n") long countByPollIdAndVoterId(Long pollId, long userId)