you cannot "guard" against such a thing in the database unless you have an exclusive lock on the table. size() and iterator() are independent of each other unless you are on the last page of the datatable. and even then there is not much you can do if someone is inserting/removing data from under you.

-Igor

On 4/5/06, Frank Silbermann <[EMAIL PROTECTED]> wrote:

 

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Igor Vaynberg
Sent: Tuesday, April 04, 2006 6:32 PM
Subject: Re: [Wicket-user] ?Contract for "Iterator IDataProvider.iterator(int first, int count)" ???

 

If so, I would ask _which_ framework method _ should_ trigger the retrieval of database information needed by both IDataProvider methods?  If I knew which of the two methods were called first – I could put the database query there.  Or, perhaps the database query should be triggered by some other framework method which is called before either of them.

you are meant to do two queries:

size() { return { select count(*) from blah } }

iterator(int first, int count) { return { select * from blah where rownum>=first and rownum<first+count }}

-Igor

These two methods could return inconsistent results if other users' intervening CRUD operations affected the number of rows returned.

So if I want to guard against that, I should allow either one of these methods to download the rows and count them.  Each method should do that only if the other method hasn't done it first. Is that the idea?


Reply via email to