查询返回多值时处理

public Object doInHibernate(Session session) throws HibernateException,
SQLException {
String sql ="select t2.finno,t2.fintype  from EXPENSE_TRAVELFEEAPP t1 inner join EXPENSE_CNPCCIAPP t2 on t1.appfinno=t2.finno and  t1.finno='"+finNo+"' ";
Query query = session.createSQLQuery(sql);
List<String> list = query.list();
List<String> list_res = new ArrayList<String>();
for(Object obj : list){
Object[] objs = (Object[])obj;
list_res.add(objs[0].toString());
list_res.add(objs[1].toString());
}

return list_res;
}

猜你喜欢

转载自blog.csdn.net/huanfengzhiqiu/article/details/43232529