vaadin-lazyquerycontainer
vaadin-lazyquerycontainer copied to clipboard
constructBean() is called if the number of Items retrieved is less than the expected count()
constructBean() is called if the number of Items retrieved is less than the expected count of items. This may happen if the backend data has been modified after count is retrieved, but before the get-data is retrieve,. since the count query and get-data query do not run in the same transaction.
Maybe the constructBean() could be allowed to return null in such case. Even better, the container should handle such cases and the constructBean() shouldn't be called at all - it makes no sense to call constructBean() for read-only Queries after all.
The stack trace:
java.lang.RuntimeException: Error in bean construction or property population with default values.
at org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery.constructItem(AbstractBeanQuery.java:126) ~[vaadin-lazyquerycontainer-7.6.1.3.jar:7.6.1.3]
at org.vaadin.addons.lazyquerycontainer.LazyQueryView.queryItem(LazyQueryView.java:294) ~[vaadin-lazyquerycontainer-7.6.1.3.jar:7.6.1.3]
at org.vaadin.addons.lazyquerycontainer.LazyQueryView.getItem(LazyQueryView.java:262) ~[vaadin-lazyquerycontainer-7.6.1.3.jar:7.6.1.3]
at org.vaadin.addons.lazyquerycontainer.LazyIdList.get(LazyIdList.java:91) ~[vaadin-lazyquerycontainer-7.6.1.3.jar:7.6.1.3]
at org.vaadin.addons.lazyquerycontainer.LazyQueryContainer.getIdByIndex(LazyQueryContainer.java:230) ~[vaadin-lazyquerycontainer-7.6.1.3.jar:7.6.1.3]
at com.vaadin.data.ContainerHelpers.getItemIdsUsingGetIdByIndex(ContainerHelpers.java:88) ~[vaadin-server-7.7.0.jar:7.7.0]
at org.vaadin.addons.lazyquerycontainer.LazyQueryContainer.getItemIds(LazyQueryContainer.java:655) ~[vaadin-lazyquerycontainer-7.6.1.3.jar:7.6.1.3]
at com.vaadin.server.communication.data.RpcDataProviderExtension.pushRowData(RpcDataProviderExtension.java:375) ~[vaadin-server-7.7.0.jar:7.7.0]
Did you head a look at #84 -- I think you're facing the same issue than me.
I have a fix for this issue (in my local workspace). I am not sure what the process is to contribute a fix to github (like, is there a review process)? The fix is in LazyQueryView.queryItem(index):
- make this line not final: final int count = Math.min(batchSize, getQuerySize() - startIndex);
- add this line after 'final List<Item> items = getQuery().loadItems(startIndex, count)' : if (items.size() < count) { count = querySize = items.size(); }