Yes I have. In the JPA Criteria Query container, which wraps LZQ, I ended up caching the results of the size() method in order to avoid excessive queries. Table does appear to be the culprit.
Since implementing a service-based variant likely led you to get a fairly detailed understanding of LZQ, you can likely just borrow the relevant pieces of code from JPA Criteria Query Container (source is online)
I’ve implemented the size cache too, but I had to create my own LazyQueryView because the private method below:
private void queryItem(final int index) {
final int batchSize = getBatchSize();
final int startIndex = index - index % batchSize;
final int count = Math.min(batchSize, [b]
getQuery().size()
[/b] - startIndex);
I think you have missed this piece too, because you are calling lazyQueryView.getItem in your BeanTupleQueryView:
public Item getItem(int index) {
init();
// standard behavior of getItem.
Item item = lazyQueryView.getItem(index);
return item;
}
I
put up a patch with a
pull request if anyone’s interested. It was pretty simple and could have been done in extensions of the AbstractBeanQuery but could not due to a call inside the private method.