What ways are recommended to implement lazy loading for the Vaadin table?
Does it support this from its own?
Or Do I have do use an apropriate container for the table?
How does that work with EJB?
Or is the JPAcontainer the only recommended way of implementing that?
Hm. The Vaadin table does not support lazy loading on its own then. Seems that Vaadin team does not have written a guide on that either.
Anyway, thanks for your help.
I have my EJB layer in place, from a previous application implementation.
How can I use the “Lazy Query Container” add-on then? I have my beans already in a list, which I would like to hand out directly to the container that is attached to the table. Possible?
As Jean-François Lamy already answered you will need a container that supports lazy loading. That kind of containers are for example
JPAContainer , SQLContainer and
Lazy Query Container . IndexedContainer is just an in-memory container. If you have EJBs then the Lazy Query Container is the way to go. Unfortunately I haven’t used it myself.
Both TreeTable and Table work with lazy loading containers. In Table and TreeTable, there is also lazy loading on how rows are transferred from server to browser. If you have lots of rows in your Table, only a small amount of rows is transferred at a time. And when user scrolls to a certain position, the rows visible at the position are loaded from the server to the browser. See methods
setPageLength ,
setCacheRate .
EDIT: I created a ticket about the setLazyLoading method.
Thank you very much for creating the ticket!!
Could you please post a code-snippet on how I then best can display my List that I already have from the middleware layer with a Vaadin table using Lazy Query Container?
I dont want to run the queries from the UI layer - data is already in place and provided by the middleware.
I also measured where time goes, and it is NOT at picking the data from the database, and it is NOT sending the page to the client. Time goes when table/container is populated - which is way too slow for using that in production.
However i get a nice ConcurrentModificationException, when trying to access the DAL using my own GenericDAO instead of using the LazyQueryFactory built-in
LazyQueryContainer API.
i m trying to load some dummy data into the Customer Entity created using JPA, and within the click Listener i’m calling my generic dao which returns a list of
entities/items, which i use to populate the EntityContainer Instance.
However at creation the EntityContainer needs a default NO-ZERO argument( else a nice Math Exception is thrown… ), and what i’m thinking is that LQC at instantiation
it builds the container and populates it, rather than when i am clicking the “get-customers-button”.
Here’re some snippets:
Table customerTable = new Table("All Customers Table");
entityContainer = new EntityContainer<>(entityManagerShared, true, true, true, Customer.class, 1, new Object[]{FIRST_NAME}, new boolean[]