String hql = "select bg.id as id,bg.groupId as groupId, b.id as businessId,"+" g.name as groupName,b.name as businessName"
+" from Business b, Businessgroup bg, Groups g "
+" where bg.groupId=g.id and bg.businessId=b.id order by bg.groupId asc";
Session session = this.getSession();
Query query = session.createQuery(hql);
query.setFirstResult(start);
query.setMaxResults(limit);
query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);//这样会把所有查询的列放到一个元素为Map的list中。
return query.list();
然后遍历list,从map中以列明为键值取出相应的value,再set到po中
for(int i=0; i<list.size(); i++){
map = (Map) list.get(i);
}
此方法来自互联网。
+" from Business b, Businessgroup bg, Groups g "
+" where bg.groupId=g.id and bg.businessId=b.id order by bg.groupId asc";
Session session = this.getSession();
Query query = session.createQuery(hql);
query.setFirstResult(start);
query.setMaxResults(limit);
query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);//这样会把所有查询的列放到一个元素为Map的list中。
return query.list();
然后遍历list,从map中以列明为键值取出相应的value,再set到po中
for(int i=0; i<list.size(); i++){
map = (Map) list.get(i);
}
此方法来自互联网。