3 Replies Latest reply on Oct 3, 2006 1:29 PM by Monkey Den

    Data not getting refreshed, how to disable cache?

    Samuel Mendenhall Apprentice

      I am wondering how I disable cache on a per Query basis to ensure the latest data?

      In my code I am select a list of jobs to be displayed in the view. The status of the jobs gets updated frequently, however the changes are not being shown in the view. In the output of jboss, I do get the sql being generated, so I know a database call is happening, I am assuming the data being returned is cached data.

      How Do I indicate to the entity manager NOT to cache this data, or to force a fresh retrieval?

      ...
      
       Map parameters = new HashMap();
       StringBuffer queryString = new StringBuffer();
       queryString.append("from Job");
       Query query = em.createQuery(queryString.toString());
       jobs = (List<Job>) query.getResultList();
      
      ...
      



      Thanks.