Hi,
What I am trying to do seems pretty simple and a straightforward implementation of the setMaxResults and setFirstResult API's.
Below is the code I am using to retrieve a list. Once the list is retrieved I am creating a subset of the list to return to the user and I am using the setMaxResults & setFirstResult API. This works fine in a single user siduation and there is no problem scrolling through the list using this code. However, the probelm arises when I have 2 sessions going against an identical list using this code.
If one session ( user ) deletes an item from the list, the first user skips records that should be there when scrolling. If no deletion ( or insertion ) occurs then scrolling through the list works fine.
Can anyone recommend a workaround or a more suitable way of coding
Criteria crit = session.createCriteria(fromData.getClass()).add( Expression.between(readKey, fromReadValue, toReadValue));
crit.setMaxResults(5);
crit.setFirstResult( ( 5 * get_cur_page_number() ) );
list = crit.list();
|