我有我的代碼這個查詢:拋出:IllegalArgumentException - 參數與該名稱(姓名)不存在
return Long.parseLong(getEntityManager().createQuery(
"SELECT COUNT(a) FROM ApartmentExtraType a WHERE a.accommodation.id = :idacc AND (LOWER(a.name) LIKE :name)",
Long.class)
.setParameter("idacc", accommodation.getId())
.setParameter("name", "%" + filterQuery.getFieldFilter("name").toString().toLowerCase() + "%")
getSingleResult().toString());
如果查詢沒有找到任何元素我沒有問題,但如果它發現在至少有一個元素,我有這個錯誤:
Last cause: Parameter with that name [name] did not exist WicketMessage: Error attaching this container for rendering:
[WebMarkupContainer [Component id = tbody]]
相對列的名稱是「名稱」,我敢肯定。其他查詢似乎是相同的這一個,他們工作得很好。我不知道哪個是問題
我控制如果問題是getFieldFilter,但我不這麼認爲,因爲syste.out打印正確的字符串。 –