I’m accepting dates from a wicket form – now I want query my DAO object with the dates and get the filters result. So the question is how can I pass parameters in models ? or Can I pass parameters in model?
The model by default call the getObject() method – which can’t take any parameter–
and if I use the model I can’t call the other method I created (getByDates(startDate,endDate))
what is the best way to pass parameters to DAO and get show the result in front end..
eg. Dataprovider / models etc …
final AbstractReadOnlyModel<List<LogParsed>> listModel = new AbstractReadOnlyModel<List<LogParsed>>()
{
@Override
public List<LogParsed> getObject() {
// TODO Auto-generated method stub
return logParsedDao.findAll();
}
public List<SyslogParsed> getObject(Date startDate, Date endDate) {
// TODO Auto-generated method stub
return logParsedDao.findByDates(startDate, endDate);
}
};
Typically if the dates are not part of your domain model, but rather items you need in the user interface, then you can make them part of your page, panel or form, and then reference them in your anonymous inner class: