Avoid java.heap.space with BeanItemContainer

Hi everyone,

So the main problem is that if I put a lot of data to a List with a query that I also put at BeanItemContainer that i need to display in a table component, when this query is so large I’m getting java.heap.space. Consider that this application go to be bigger every day so I need something that can hold…
I also tried JPAContainer without success because is so much slow for the purpose of the application.

If anyone know better solution are welcome.


– Xavi.

Large data set shouldn’t be loaded to memory, you should only load what is actually needed by the UI. There isn’t anything in the core framework that would allow you to do this, but there is a third party add-on,
, that I’ve used successfully before.

Like Kim said, switching to a different Container implementation is the key here. Even switching to more efficient in memory container might help. In
there is ListContainer, which has really small overhead. In one million entity test, BeanItemContainer consumes about tenfold amount of memory to the actual data set (100m → ~ 1g) as with ListContainer there is almost no overhead at all as it lazily creates Item instances for Table/Tree/Select/Grid.

Viritin also has the easiest lazy data binding solutions I know for Vaadin. Check out our
XRebel profiling webinar
to see comparision of various data binding solutions and how they affect different aspects of your performance.


Thanks for responses!

My project is in Vaadin 6 so as I can see Virtin only works with Vaadin 7…
I’m trying with LazyQueryContainer as Kim said but I don’t really know how can be implemented.
The way where I go is the same as I take with JPAContainer or BeanItemContainer I mean I do something like this with JPA & BeanItem containers…

peticionsMastersview = JPAContainerFactory.make(PeticionsMastersView.class, PERSISTENCE_UNIT); BeanItemContainer

TypedQuery<PeticionsMastersViewGest> q1 = emmanager.createQuery("SELECT p FROM PeticionsMastersViewGest p", PeticionsMastersViewGest.class); List<PeticionsMastersViewGest> peticionsMastersGest = q1.getResultList(); peticionsMastersBean = new BeanItemContainer(PeticionsMastersViewGest.class, peticionsMastersGest); So I’m trying to do something like this with LazyQueryContainer but AFAIK can’t do this instead I should implement by my hand the methods to do the querys.
Hope can bring me some appropriate documentation or any help.



Have you looked at the
? It contains a JPA example

Yes I do, didn’t see before, currently implementing!
Thanks for the help

– Xavi.