方法一: ……
String hql = "select t.fsHostip, t.fiReserve1 from Thostip as t where 1 = 1";
List ls = dao.getHibernateTemplate()。find(hql);
Iterator it = ls.iterator();
if(it.hasNext()){ // while 用这个的时候和下面的一样
Object[] obj = (Object[]) it.next();
String ip = (String) obj[0];
Integer rs = (Integer) obj[1];
System.out.println(ip +","+rs);
}
方法二:
// for(int i = 0; i < ls.size(); i++){
// Object[] obj = (Object[]) ls.get(i);
// String ip = (String)obj[0];
// Integer rs = (Integer)obj[1];
// System.out.println(ip +","+rs);
// }
|