hibernateTemplate.find方法的使用,查的list不是空,但是遍历时却是null
hql="fromClPendTaskHisascwherec.id.treqTaskType='1'";Listlist=hibernateTemplate.find(...
hql="from ClPendTaskHis as c where c.id.treqTaskType='1'";
List list =hibernateTemplate.find(hql);
Iterator iterator =list.iterator();
while ( iterator.hasNext()) {
System.out.println(iterator==null);
System.out.println(iterator.next()==null);
ClPendTaskHis clpendtaskhis = (ClPendTaskHis)iterator.next();
System.out.println(clpendtaskhis==null);
System.out.println(hibernateTemplate.find(hql).size());
输出结果:
false
true
true
2
} 展开
List list =hibernateTemplate.find(hql);
Iterator iterator =list.iterator();
while ( iterator.hasNext()) {
System.out.println(iterator==null);
System.out.println(iterator.next()==null);
ClPendTaskHis clpendtaskhis = (ClPendTaskHis)iterator.next();
System.out.println(clpendtaskhis==null);
System.out.println(hibernateTemplate.find(hql).size());
输出结果:
false
true
true
2
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询