标签:
1、查询结果填充到实体list
try{
Session session =null;
SQLQuery sQuery =null;
session = this.getSession();
sQuery = session.createSQLQuery(sql.toString());
sQuery.addScalar("areaNo", Hibernate.STRING);//查询结果列名
sQuery.setResultTransformer(Transformers.aliasToBean(P2pNewCustomerInfoForm.class));
sql = null;
return sQuery.list();
} catch (Exception e) {
String result = "查询上个月新进客户信息异常!";
log.error(result, e);
throw new APSException(result, e);
}finally{
this.releaseSession(session);
}
//查询条数
session = this.getSession();
sQuery = session.createSQLQuery(sql.toString());
sql=null;
int totalCount = Integer.parseInt(sQuery.uniqueResult().toString());
标签:
原文地址:http://www.cnblogs.com/Defry/p/5454651.html