I am using a LoadableDetachableModel to save some search results in Wicket. For every result such a model is made. This is the code :
private List<IModel<ResultItem<?>>> results;
ResultItemModel(ResultItem<?> object, int index) {
super(object);
this.index = index;
}
@Override
protected ResultItem<?> load() {
return results.get(index).getObject();
}
The constructor gets the object and the index where in the List the item is, so when I do getObject(), it loads the object from the list. But I am receiving a NullPointer when I try to get the objects. Is there something I am missing?
When I debug, I see that the all the correct items are in the list but they later get detached.
Kind regards,
Merlijn