Lazy Container is not acting lazy...

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

I have discovered that in fact the container does appear to loading a limited number of entries each time. So the lazy loading appears to be working. The problem seems to be that the first time I reference the container, the system hangs for about 60 seconds and then I get a timeout or session failure on my web browser. The second time I run the program, it appears to take about 15 seconds to load my table, after which it behaves normally. The data appears to be loaded incrementally as I scroll around the table, which is what I want, but there still seems to be a huge increase in memory useage, and I can’t figure out why it won’t display the table on the first instantiation of the program.

Any suggestions about what I might be doing wrong would be helpful - it doesn’t seem to be a problem with the container - at least not directly, which is good…

thanks,

nbc