日期:2014-05-17 浏览次数:20707 次
public Iterator<Infos> getInfos(String infocataguid) { StringBuffer totalBuffer = new StringBuffer("select count(c.guid) "); StringBuffer iteratorBuffer = new StringBuffer("select * "); StringBuffer buffer = new StringBuffer(" from Infos c where infocataguid=?"); Session session = HibernateUtil.currentSession(); Transaction transaction = session.beginTransaction(); totalBuffer.append(buffer).append(" order by c.pubdate desc"); Query query = session.createQuery(totalBuffer.toString()); query.setString(0,infocataguid); Integer total = (Integer) query.uniqueResult(); setTotal(total); Iterator<Infos> iterator = null; if (total > 0) { iteratorBuffer.append(buffer).append(" order by c.pubdate desc"); query = session.createQuery(iteratorBuffer.toString()); //query.setString(0,infocataguid); query= query.setFirstResult(startRow()).setMaxResults(num()); System.out.println(query); //能出结果 select * from infos t where t.infocataguid='402881c23527443c0135274541510002' order by t.pubstate List<Infos> list = query.list(); System.out.println("不继续执行");//不出结果 iterator=list.iterator(); } transaction.commit(); HibernateUtil.closeSession(); return iterator; }
System.out.println("不继续执行");//不出结果