利用hibernate查询语句查询信息,默认当日,否则往前推

	
public List selectcheckQualityAir(final String time) {
final String hql= "select air from AhemcQualityAir air where air.isDelete=0 and air.strtes1=1 and air.reportDate=? order by  air.cityname asc";
List list = getHibernateTemplate().executeFind(
new HibernateCallback() {
public Object doInHibernate(Session session)throws HibernateException, SQLException {
List list = null;
Query query = session.createQuery(hql);//
for (int i = 0; i >-10; i--) {			
String time1=DateUtil.calculateDateByNumber(i);
query.setDate(0, DateUtil.stringToUtilDate(time1));
list = query.list();
if (list != null && list.size() > 0) {
break;
}							
}
return list;
}
});
return list;
}

你可能感兴趣的:(利用hibernate查询语句查询信息,默认当日,否则往前推)