Interface GameRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Game,Long>, org.springframework.data.repository.Repository<Game,Long>

@Repository public interface GameRepository extends org.springframework.data.repository.CrudRepository<Game,Long>
  • Method Summary

    Modifier and Type
    Method
    Description
    getNumCows(Long gameId)
     
    getNumUsers(Long gameId)
     

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll
  • Method Details

    • getNumCows

      @Query("SELECT sum(uc.numOfCows) from farmer uc where uc.game.id = :gameId") Optional<Integer> getNumCows(Long gameId)
    • getNumUsers

      @Query("SELECT COUNT(*) FROM farmer uc WHERE uc.game.id = :gameId") Optional<Integer> getNumUsers(Long gameId)