Hi Guys,
I’m getting an exception when setting up a simple Vaadin CRUD component with a ListDataProvider.
When I comment out the setDataProvider line, the page loads up just fine (albeit with no records).
Any Ideas? I’m pretty new to v12, but it seems to me that ListDataProvider implements all the serial predicate filters - so I’m not quite sure what’s going on here.
This app is based on bakery demo. So the repository .findAll() just returns a list of beans.
~Ben
Java Code:
Crud<Recipe> crud = new Crud<>(Recipe.class, createForm(layout));
setSizeFull()
add(crud)
crud.getGrid().removeColumnByKey("id");
crud.getGrid().removeColumnByKey("version");
crud.setDataProvider(new ListDataProvider(service.getRepository().findAll()));
Exception Log (The important bit):
java.lang.ClassCastException: com.vaadin.flow.component.crud.CrudFilter cannot be cast to com.vaadin.flow.function.SerializablePredicate
at java.util.Optional.map(Optional.java:215) ~[na:1.8.0_191]
at com.vaadin.flow.data.provider.ListDataProvider.getFilteredStream(ListDataProvider.java:99) ~[flow-data-1.2.4.jar:1.2.4]
at com.vaadin.flow.data.provider.ListDataProvider.size(ListDataProvider.java:86) ~[flow-data-1.2.4.jar:1.2.4]
at com.vaadin.flow.data.provider.DataProviderWrapper.size(DataProviderWrapper.java:85) ~[flow-data-1.2.4.jar:1.2.4]
at com.vaadin.flow.data.provider.DataCommunicator.getDataProviderSize(DataCommunicator.java:336) ~[flow-data-1.2.4.jar:1.2.4]
at com.vaadin.flow.data.provider.DataCommunicator.flush(DataCommunicator.java:449) ~[flow-data-1.2.4.jar:1.2.4]
at com.vaadin.flow.data.provider.DataCommunicator.lambda$requestFlush$2f364bb9$1(DataCommunicator.java:421) ~[flow-data-1.2.4.jar:1.2.4]
at com.vaadin.flow.internal.StateTree.lambda$runExecutionsBeforeClientResponse$1(StateTree.java:350) ~[flow-server-1.2.4.jar:1.2.4]
at java.util.ArrayList.forEach(ArrayList.java:1257) ~[na:1.8.0_191]