JPAContainer NPE when refreshItem is called


I have a little problem, I have a table displaying data from my database with the jpacontainer addon.

Everything works really well.

But I am updating some data somewhere else.

If I refresh the browser updated values are well updated in the table. But I have to force refresh without using F5 key :wink:

So I created something like this :

public void refresh()
		for(Object itemId : container.getItemIds())

And it failed, and generate an null pointer exception :

Caused by: java.lang.NullPointerException
	at com.vaadin.addon.jpacontainer.JPAContainer.refreshItem(
	at MyTable.refresh(
	at MyGui$1.buttonClick(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at com.vaadin.event.ListenerMethod.receiveEvent(
	... 31 more

And I don’t realy understant why.

Can someone give me some help ?

Thanks for all your great work.


Are you using an RC version or the release version? One bug like that was recently fixed. Also you could use container.refresh() instead of looping all items. That should do pretty much the same thing.


I am using the 2.0.0 release.

I tried to use refresh on the container, but I failed in an other way (infinite call to something related to the fact that my entity have a @PostLoad anotation).

Because I may not be on the same timezone I will not be able to read anything before tomorrow.


Nevermind, I manage to solve my problem.

In fact my entity have a
relation, and also, a
function that try to find the last item of the

When I was using the
method, it failed with
, that’s why I tryied to solve my problem with the loop on the items in the container.

But I manage to solve my problem, by adding a
fetch = FetchType.EAGER
on my
relation, and now, everything works !!!

Thanks !