I have caching working. I have some question based on my understanding of what I think should be happening.
My config case...
Code:
hibernate.cfg.xml
<property name="cache.use_query_cache">true</property>
<property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="net.sf.ehcache.configurationResourceName">ehcache.xml</property>
ehcache.xml
<cache name="com.my.com.Cat"
maxElementsInMemory="20" eternal="false" timeToIdleSeconds="120"
timeToLiveSeconds="180" overflowToDisk="false" />
Cat.hbm.xml
<class name="com.my.com.Cat" table="`CATS`"
dynamic-insert="true" dynamic-update="true">
<cache usage="read-write" />
...
</class>
Code:
HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
The JAVA code
Cat c;
c = cDAO.findById(1, false); // <-- Dao as described in hibernate wiki and docs. Uses load()
HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();
The above code runs in a web service stress tested by SOAP UI. You would think that after the first call to the web service that there would be no activity on the Db but there is. What is going on exactly?