We use the same workaround :o) 

-----Original Message-----
From: Michael O'Cleirigh [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 26, 2008 9:43 AM
To: users@wicket.apache.org
Subject: Re: Is there any other way? DataProviders must hit the Db twice
for (possible) large datasets

Hi Wayne,

The way we do it is to only extract the current page from the data
provider once per render cycle.

e.g. the first time size() is called the underlying extraction is
performed to build the list for the size of the current page and all
subsequent calls use this cached value.

You just need to clear the cached state in provider.detach() so that the
next time size() is called (on the next render) the data will be
reloaded properly.

With our project we use the size of the data provider to determine
component visibility (i.e. >0 rows == is visible) which results in alot
more calls of provider.size() but with this caching approach the
rendering performance is not impacted.

Regards,

Mike
>
> I was just having a bit of code clean up and I realized that in our 
> IDataProviders we are loading all rows for a given dataset.
> So looking at the iterator method I see we can limit the result (and 
> the offset). Great I thought - however I see that that the size() 
> method is called as part of the getViewSize() in the 
> AbstractPageableView. Thus I need to call the database here to figure
out the size.
>
> Am I doing sonething wrong or have I got to hit the database twice for

> each DataProvider render.
>
> Obvously I don't want to hard code a size. Is there any other way ?
>
> Thanks
> Wayne
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to