Я пытаюсь запросить базу данных postgres из репозитория jpa следующим образом:
@Query(value =
"SELECT " +
"string_agg(distinct customer_po, ', ') as customer_po, " +
"customer_part, " +
"description, " +
"bunzl_loc, " +
"sum(dayspastexpected) as longestGrouping, " +
"string_agg(distinct priority, ', '), " +
"sum(open_qty) as totalBoQty, " +
"sum(current_oh) as sunAvail, " +
"next_receipt " +
"FROM " +
"sap_data.openorders_report " +
"WHERE " +
"run_date between :from and :to " +
"AND " +
"backorderorfuture = 'Future' " +
"GROUP BY " +
"customer_part, " +
"bunzl_loc, " +
"description, " +
"next_receipt " +
"ORDER BY " +
"customer_part desc, " +
"bunzl_loc desc /*#pageable*/",
nativeQuery = true)
Page<SapOpenOrder> getBackOrderReport(@Param("from") Date from, @Param("to") Date to, Pageable pageable);
, но получаю эту ошибку:
org.postgresql.util.PSQLException: ERROR: syntax error at or near "WHERE"
Я могу выполнить этот запросв dbeaver и получите правильные результаты.Как мне выполнить этот запрос с помощью Spring jpa?