I have an SQLContainer using a TableQuery and one Equals filter on one of its primary keys. Autocommit is false. This particular instance has 206 items, which is 6 more than the cache size. When I call removeAllItems() on it, it doesn’t seem to be paging properly. It removes the first 200 fine, but then when it tries to retrieve the next page, it just gets that same page of 200 again. It looks like it’s seeing that the offset (200) is greater than the size (6, since 200 were removed), and thinking it wrapped around, resetting the offset to 0. This creates an infinite loop.
I know that calling removeItem() while iterating over getItemIds() isn’t allowed, but if I simply call removeAllItems(), I’d expect all items to be removed as the documentation suggests. I haven’t seen anyone else with this issue though and I’d think this would be a fairly common operation, so I’d be surprised if this was a Vaadin bug and not a problem on my part. Obviously I can get around the issue for now by increasing the page length, but that’s not a very scalable solution.
PS: Calling removeAllItems() with autocommit=true always results in “java.lang.IllegalStateException: A transaction is already active!” because it calls delegate.beginTransaction() twice: once before iterating over the items, and again inside getItemIds(). (see
http://dev.vaadin.com/ticket/8603
)
I’m using Vaadin 7.1.6