EntityManager refresh

前端 未结 6 900
生来不讨喜
生来不讨喜 2020-12-08 10:05

I have web application using JPA. This entity manager keeps bunch of entites and suddenly I update the database from other side. I use MySQL and I use

6条回答
  •  一整个雨季
    2020-12-08 11:06

    Well, for some people (like me) that tried to add factory.getCache().evictAll(); and doesn't work, and are used JPA + Hibernate, to refresh a query add the hint org.hibernate.cacheMode to IGNORE. Example:

    em.createNamedQuery("SomeEntity.SomeNamedQuery")
      .setHint("org.hibernate.cacheMode", "IGNORE")
      .getResultList();
    

提交回复
热议问题