I am working on adding a LazyEntityContainer to my project. I have managed to get the container to load my database table and populate a Vaadin table, but it appears to be loading the entire 500k records instead of the 100 at a time that I tried to specify.
I would appreciate it if someone could tell me what I’m doing wrong in this code:
LazyEntityContainer<Metric> container = null;
Table table = null;
container = new LazyEntityContainer<Metric>(myEntityMgr, Metric.class, 100, "id", true, true, true);
// "id" is the column name of my primary key
container.addContainerProperty("id", Integer.class, 0, true, true);
container.addContainerProperty("rrdPath", String.class, "", true, true);
table = new Table();
table.setWidth("100%");
table.setSelectable(true);
table.setImmediate(true);
table.setContainerDataSource(container);
table.setVisibleColumns(new Object[] { "rrdPath" });
When I run this code, the program sits there for about 1 minute (the little cursor in the top right goes yellow, then red) and then it times out with a Communications failure. When I run it a second time, it takes 5-15 seconds and then it loads the table. I can select entries from the table and process them.
A call to container.size() returns 500000 (approx - whatever the # rows in the database table actually is). Does that mean it has loaded all 500k rows? Should the size be 100?
How do I get this to be lazy? What have I missed?
Thanks,
nbc