Na camada repository:
@Repository public interface MoedasRepository extends JpaRepository<Moedas, String> {
@Query(value = "SELECT TOP 50 * FROM moedas m ORDER BY m.rank WHERE m.rank < :rank",
nativeQuery = true)
List<Moedas> findMoedasByFavoritas(Long rank);
}
Camada controller:
@GetMapping("rankMoedas") public List getALlTopMoedas(@RequestParam(value = "rank", required = false) Long rank) { return moedasRepository.findMoedasByFavoritas(rank); }
O erro que esta dando é este:
could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet