/**
* 查询省份名称
* @author YHD
* @return
* @see
*/
@SuppressWarnings("unchecked")
@Override
public List<Province> findProvince()
{
List<Province> proList = new ArrayList<Province>();
StringBuffer sb = new StringBuffer();
sb.append("SELECT ");
sb.append("t.province_code,");
sb.append("t.province_name,");
sb.append("FROM ");
sb.append("t_province_tab t ");
sb.append("order by t.province_code ");
SQLQuery query = getSession().createSQLQuery(sb.toString());
List<Object[]> list = query.list();
if(null != list && list.size() > 0)
{
Province pro = null;
for(Object[] obj:list)
{
pro = new Province();
pro.setProvinceCode(null==obj[0]? "":obj[0].toString());
pro.setProvinceCode(null==obj[1]? "":obj[1].toString());
proList.add(pro);
}
}
return proList;
}
SSH2三大框架SQL查询