2 Replies Latest reply on Jan 13, 2009 1:46 AM by Ramazan Pekin

    Clean Hibernate Second Level Cache

    Ramazan Pekin Newbie

      Hi,

      I am using Hibernate 3.3.1 and JBoss Cache 2.1.1 as second level cache. My application is Cluster-Wide structured and I have configured multi regions. I want to clean cache manually. I dont know am I doing it right way, but it is working. Is this code true for cleaning cache?

      Map<String, Region> allSecondLevelCacheRegions = ((SessionFactoryImpl)sessionFactory).getAllSecondLevelCacheRegions();
      Collection<Region> cacheRegions = allSecondLevelCacheRegions.values();
      for (Region region : cacheRegions) {
       region.destroy();
      }
      


      If it is not true, can you give me any idea?