1 回答
TA贡献1806条经验 获得超5个赞
您忘记将parametersas添加arguments到查询方法中,请看这里:
public List<EmployeeHolidays> retrieveHolidays(Date startDate,Date endDate){
String sql = "SELECT * FROM HOLIDAYS WHERE DATE >= ? AND DATE <= ? ";
List<EmployeeHolidays> list = template.query(
sql ,
new Object[] { startDate, endDate} //add this
new RowMapper<EmployeeHolidays>(){
public EmployeeHolidays mapRow(ResultSet rs,int rownumber) throws SQLException{
EmployeeHolidays e = new EmployeeHolidays();
e.setDate(rs.getDate(1));
e.setReason(rs.getString(2));
e.setStatus(rs.getString(3));
return e;
}
});
return list;
}
添加回答
举报