我从HQL选择使用NHibernate,它返回一个对象列表。但问题是,我无法退货。该声明只是永远运行,永远不会完成。
我在选择中做错了吗?或者它可能是数据库问题?
以下是代码:
public IList<SubTask> GetAll(Client client, string filter)
{
string qryString;
QueryParameter[] queryParams = new QueryParameter[1];
queryParams[0] = new QueryParameter("clientObj", client); // Use Client as obj
//include tasks that are completed / closed / cancelled is included in query
qryString = "select st from SubTask st
where st.RaisedByClient.ID=" + client.ID + "
or (st.ParentTask.ParentProject.ParentClient=:clientObj
and st.ParentTaskCategory.VisibleToClient=1 "
+ filter + // more ands
") order by st.CreateDateTime";
IQuery qryGetAll = _session.CreateQuery(qryString);
qryGetAll.SetEntity("clientObj", client);
IList<SubTask> list = qryGetAll.List<SubTask>();
return qryGetSubTasksWithFilter.List<SubTask>();
}