I'm having a bean that basically calls getSession().createCriteria(ObjClass.class).list();
each time a request is made. It takes 16 secs to load everything first time, then it takes like 1 or so. Thing is that in a unit test cache works great, but when multiple requests are made to a bean, it never even uses cache. Question is why?
Info: it's a second level hibernate (3.5.x) cache (2.0) with org.hibernate.cache.HashtableCacheProvider
and query level cache usage turned on. Using richfaces 3.3.3 request scoped bean with keep alive enabled.
If you don't make the query cachable, it won't be cached:
getSession().createCriteria(ObjClass.class)
.setCacheable(true)
.list();
You could also set the cache region for more fine-grained configuration.