RequestFactory - no consistent data from DB
i am exprimenting with the RequestFactory and managed to get Data from it and it worked like it should and i get all my data.
But when i refresh the page it doesn't get new data from the server. It looks like it cache the data and use the old. My EclipseLink JPA don't tell me new database queries , also i changed the data in the DB and i only get the old data.
I use that query:
requestFactory.projectRequest().findAllProjects().fire(new Receiver<List<ProjectProxy>>() {
@Override
public void onSuccess(List<ProjectProxy> response) {
view.setProjects(response);
}
开发者_JS百科 });
on the server side:
public static List<Project> findAllProjects() {
EntityManager em = entityManager();
try {
List<Project> list = em.createQuery("select p from Project p").getResultList();
// force to get all
list.size();
return list;
} finally {
em.close();
}
}
Where am i wrong? onModuleLoad gets called on refresh.
This is probably the JPA/eclipselink cache. If you modify data outside your application, like directly editing the database it's not picked up directly. See also this question and answer: Disable caching in JPA (eclipselink)
精彩评论