Steve Knight schrieb:
If my SortableDataProvider implementation will always return the max number of results (I'm not using paging), is it safe to have the size() method simply return Integer.MAX_VALUE instead of performing a database query to count the actual results?
You shouldn't. It might not give you problems right now, but you break the contract with the interface.
You can cache the result so that you do only one query per request to get both the result size and the result values. Use onDetach to clear the cache after each request.
It should look like this (pseudo-code): private List result; void onDetach() { result = null; } Iterator iterator(from, to) { return getData().iterator(); } int size() { return result.size(); } private Collection getData() { if (result == null) { result = dbquery(from, to); } return result; } Timo ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user