public List findLineDataByProperty(String propertyName, Object value) {
log.debug("finding VehicleInfo instance with property: " + propertyName
+ ", value: " + value);
SimpleDateFormat sf =new SimpleDateFormat("yyyy-MM-dd");
Calendar rightNow =Calendar.getInstance();
Date startDate= new Date();
try {
startDate = sf.parse( sf.format(startDate));
} catch (ParseException e) {
e.printStackTrace();
}
rightNow.setTime(startDate);
rightNow.add( Calendar.DAY_OF_MONTH,1);
Date endDate = rightNow.getTime();
log.info("Start:"+sf.format(startDate)+" End"+sf.format(endDate));
try {
String queryString = "from VehicleInfo as model where model."
+ propertyName + "= ? and model.Gpstime >=? and model.Gpstime < ? order by model.Gpstime desc";
return getHibernateTemplate().find(queryString,new Object[]{value,startDate,endDate});
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}