开发者

EJB's and JPA: Update on database will not show on page until server is restarted

I have built an application with EJB's and JPA2. If I have my page running and I change something in the database it will not show on the page. I've tried different browsers, non caching sessions of the browsers, etc. The only way I can see the new data is if I restart glassfish 3.1. I have gone through debugging and it's obviously building a new list every time but the data it's getting is old.

Here is my findAll method.

public List<T> findAll() {
    CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
  开发者_StackOverflow  cq.select(cq.from(entityClass));
    return getEntityManager().createQuery(cq).getResultList();
}

Is there a setting on glassfish/ejb that tells it not to cache the database? Or something similar to this.

Just want to reiterate that restarting Glassfish fixes the problem. Until the next change of course.


You can also provide refresh hint for EclipseLink for your query. It should help and is more fine grained than completely turning off cache.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜