I am using creating a service in Spring boot Graphql, where I am using JPA to contact Redshift database. Regular queries run fine. However when I introduce pagination then I get query syntax error from Redshift database.
Below is my controller method
@QueryMapping("allProductsPaginationed")
List<Product> getProductsPaginated(@Argument("pageNumber") int pageNumber, @Argument("limit") int limit) {
return this.productService.getProductsPaginated(pageNumber, limit);
}
Below is the service code
public List<Product> getProductsPaginated(int pageNumber, int limit) {
Pageable pageable = PageRequest.of(pageNumber, limit);
Page<Product> productPage = productRepo.findAll(pageable);
retur
Below is the repository
@Repository
public interface ProductRepo extends JpaRepository<Product, String> {
}
When I hit a pagination query spring JPA seems to be generating below query
select
p1_0.product_id,
p1_0.product_name,
....
....
from
productmart.product p1_0 offset ? rows fetch first ? rows only
This query doesn't work inside Redshift console also. The error I get is
Caused by: com.amazon.support.exceptions.ErrorException: [Amazon](500310) Invalid operation: syntax error at or near "rows"
Position: 1267;
Is there some way by which I can change the pagination query suffix?