亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何使用帶注釋的查詢讓 PageRequest 在 Spring Boot 中工作

如何使用帶注釋的查詢讓 PageRequest 在 Spring Boot 中工作

一只名叫tom的貓 2022-06-15 14:38:29
我正在從 Spring Boot 1 升級到 Spring Boot 2。我試圖只挑選第一個結果。PageRequest pageRequest = PageRequest.of(0, batchSize, Sort.Direction.ASC, "id");在存儲庫上使用帶注釋的查詢@Query("select c from Component") List<Component> findReturnComponent(PageRequest pageRequest);我收到此錯誤消息but parameter 'Optional[pageRequest]' not found in annotated query 'select c from Component
查看完整描述

1 回答

?
滄海一幻覺

TA貢獻1824條經驗 獲得超5個贊

使用 Pageable 接口而不是 PageRequest

Pageable pageable = PageRequest.of(0, batchSize, Sort.Direction.ASC, "id");

@Query("select c from Component")
List<Component> findReturnComponent(Pageable pageable);


查看完整回答
反對 回復 2022-06-15
  • 1 回答
  • 0 關注
  • 333 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號