JPAContainer + Grid.setContainerDataSource()


It seems that after recently Vaadin update, i can not use jpa container as datasource of grid since grid requires now an indexed container.

I’ve also done something like this :

JPAContainer container = JPAContainerFactory.make(Entity.class, persistance_unit_name);
grid.setContainerDataSource((Indexed) container);

But u can not cast jpa container to Container$Indexed so i’ve got an error.

I’m kind of newbie at using jpa container, so if there is anyone that might know how could i solve this kind of problem i would really be grateful.

Thanks in advance.

JPAContainer implements Indexed.Container interface, so the cast should be ok. Have you checked that you are using correct version. The newest version 4.0.0 is for Vaadin 8, use version 3.2.0 with Vaadin 7.x.

Firstly i would like to thanks for your reply.
Actually i did check and i’m using the newest version of JPAContainer. I did implement it in my maven project by maven dependency.
Like this:

com.vaadin.addon jpacontainer 4.0.0

Ok, its working now. Actually i did check my version of vaadin and it was 7.7.7 instead of 8 so that was a problem.
It’s my bad and i’m sorry about it. Next time i will check everything more carefully.

Thanks again for your time.