tags:

views:

36

answers:

1

I'm using a ajax4jsf poller <a4j:poll> to check whether an entity has been updated in the database by another process. I want to reload the entity each time.

How can I force a reload?

Calling loadInstance() seems to have has no effect. (Polling works as expected)

@Name("myComponentHome")
public class MyComponentHome extends EntityHome<ComponentType> {
     public void poll() {
        log.warn("poll");
        ComponentType loadInstance = loadInstance();
        if ( loadInstance.getReportTime() != null ) {
            log.warn("poll report detected stoping poller");
            setInstance( loadInstance() );
            pollEnabled = false;
        }
    }
...
}

Versions Seam 2.1.2 Jboss 4.2

EDIT:

Maybe it's easier to answer if one knows that Seams loadInstance() is implemented as:

return getEntityManager().find(getEntityClass(), getId());
+2  A: 
getEntityManager().refresh(entity);
Bozho
Works perfect thanks.
stacker