I have a query that seems to work fine.
public interface GameRepository extends JpaRepository<Game,Integer> {
@Query(value="SELECT Cast(bifnb as varchar) bifnb , count(*) FROM (SELECT count(fk_game) as nb FROM public.game INNER JOIN score s on game.id_game = s.fk_game WHERE fk_board_game = 2014 GROUP BY fk_game) as bifnb group by bifnb", nativeQuery = true)
List<StatisticDto> nbplayer();
}
But when I try to use it with JPA and type StatisticDTO , I get the following error:
context with path [/api] threw exception [Request processing failed; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [****.statistics.payload.StatisticDto]] with root cause
So I tried with the same query and : List<Object> nbplayer();
It works but I don't know how to work with a List I prefer to use a StatisticDto.