LazyEntityContainer initialization problems

Hi,
I have some Exceptions where I use LazyEntityContainer :
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at org.vaadin.addons.lazyquerycontainer.EntityQuery.(EntityQuery.java:61)
at org.vaadin.addons.lazyquerycontainer.EntityQueryFactory.constructQuery(EntityQueryFactory.java:60)
at org.vaadin.addons.lazyquerycontainer.LazyQueryView.getQuery(LazyQueryView.java:401)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508)

Here is some parts of my code :
private LazyEntityContainer containerBouteille;

containerBouteille = new LazyEntityContainer(em, Bouteille.class, 2, “id”, false, false, false);
tableBouteille = new Table(“My Table Binded”, containerBouteille);
tableBouteille.setImmediate(true);
tableBouteille.setSelectable(true);

Bouteille b = containerBouteille.addEntity();
b.setName(“name”);
b.setQuantity(5);

containerBouteille.commit();
containerBouteille.refresh();

So I need some help.

Can someone give me some example of how to use it or a link to page where it is shown, please ?

Thanks.

Apparently that addon needs the log4j library on the classpath. Just add it to your classpath and you should be good to go.

Thanks you Thomas, It works better.

Now, I try to check if an entity is already in the LazyEntityContainer before persisting it.
I want to avoid JPQL queries if it’s possible.
The method LEC.containsId() requires the ID so I can’t use it before the persistence.
Is there a way to do that like the List.contains(Object) method does ?

Thanks.

I have another question : when I persist an entity (em.persist()), to update my table, do I have to commit the LEC or refresh it ?

Thanks.

Haven’t used the LQC myself, so unfortunately I have no clue :slight_smile: Hopefully someone else can help.