![](/img/trans.png)
[英]Hibernate HQL could not locate named parameter [parameterName]
[英]Hibernate HQL could not locate named parameter
users = (List<User>) currentSession.getCurrentSession().createQuery("FROM User as u "
+ " LEFT JOIN FETCH u.tests as p"
+" WHERE u.registrationDate BETWEEN "
+"':tenDaysBeforeDate' AND ':currDate' "
+"ORDER BY u.registrationDate DESC").setParameter("tenDaysBeforeDate", tenDaysBeforeDate).setParameter("currDate", currDate).list();
什么東西少了??? 我嘗試設置的兩個參數均為字符串類型,請幫助...
嘗試刪除參數上的單引號
users = (List<User>) currentSession.getCurrentSession().createQuery("FROM User as u "
+ "LEFT JOIN FETCH u.patients as p "
+"WHERE u.registrationDate BETWEEN "
+":tenDaysBeforeDate AND :currDate "
+"ORDER BY u.registrationDate DESC").setParameter("tenDaysBeforeDate", tenDaysBeforeDate).setParameter("currDate", currDate).list();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.