0
這裏是我的本地查詢與PARAM和分頁錯誤HQL查詢「參數與位置[1]不存在」
select * from stock_indicators si inner join stock st on si.stock_id = st.id where si.slope_simple_regression_10 > 1 and si.date = (select date from stock_details order by date desc limit 1) order by si.slope_simple_regression_10 desc
(不幸的是爲本地查詢不與分頁的工作,我不能用它)這是一個對應的HQL查詢:
@Query(value = "from StockIndicators si join fetch si.stock where si.slopeSimpleRegression10Days > 1 and si.date = :date order by si.slopeSimpleRegression10Days desc", countQuery = "select count(si.stock) from StockIndicators si where si.slopeSimpleRegression10Days > 1")
Page<StockIndicators> findWithStocksIndicators10DaysTrendUp(Pageable pageable, @Param("date") LocalDate date);
這查詢不工作,就會出現以下錯誤:
java.lang.IllegalArgumentException: Parameter with that position [1] did not exist
所以我做了什麼至今:
- 改變參數的順序(仍相同的錯誤)
- 改變了查詢包括子查詢,但不幸的是HQL不 不支持限制
- 更改的日期= :日期部分迄今=?2(仍然是相同的錯誤)
你能幫我嗎?