I'm trying to validate whether or not my hibernate/ehcache/jpa is properly configured.
When I dump stats from (psuedo code):
Code:
EntityManagerFactory ef = getEntityManagerFactory();
EntityManagerFactoryImpl efi = (EntityManagerFactoryImpl)ef;
log(("stats: " +efi.getSessionFactory().getStatistics());
and then I dump stats from:
Code:
CacheManager cm = CacheManager.getInstance();
String[] names = cm.getCacheNames();
for (String n:names){
Cache c = cm.getCache(n);
logger.info("Cache: " + n + " size: " + c.getKeys().size());
}
The stats conflict: When the stats for EntityManagerFactory are dumped it shows puts/hits in the second level cache.
but..when I actually 'look' at the caches they are empty..always..
any thoughts on whats up? (doesn't CacheManager.getInstance() return the same instance used by Hibernate?) if not..is there a sure way to acquire
the one that Hibernate/EntityManager are using?