0
所以我想用HQL做一個Select語句。HQL選擇一個OR
的選擇看起來是這樣的:
queryParams[1] = new QueryParameter("clientObj", client); // Use Client as obj in hql
queryParams[0] = new QueryParameter("clientIDObj", client.ID);
if (!includeClosedSubTasks)
{
// tasks that aren't completed/closed/cancelled
qryString = "select st
from SubTask st
where st.ParentTask.ParentProject.ParentClient=:clientObj
and st.ParentTaskCategory.VisibleToClient=1 "
+ filter + // more ands
"and st.ParentTaskStatus.ID != 3
and st.ParentTaskStatus.ID != 4 and st.ParentTaskStatus.ID != 8
or st.RaisedByClientID=:clientIDObj
order by st.CreateDateTime";
}
簡單來說,它應該這樣做:
選擇(A和B和C)或(d)ORDER BY .....
然而,當我執行此代碼,我收到了查詢語法錯誤與此腸子例外:
{「索引超出範圍必須爲非negat。並且小於集合的大小。\ r \ n參數名稱:index「}
我該如何解決這個問題?