well, yes, if the query is not specifically stated in ehcache.xml, then it will look for a definition of StandardQueryCache, ex
Code:
<cache
name="net.sf.hibernate.cache.StandardQueryCache"
maxElementsInMemory="250"
eternal="false"
timeToLiveSeconds="120"
overflowToDisk="true">
</cache>
If that's not present, I do not believe it will use the definition for defaultCache as that is for undefined objects, not queries (as far as i know).
Remember, it will only use a cached query if the parameters are identical. Also don't forget to include:
Code:
<!-- Underlying Cache impl. Tracks timestamps of most recent updates to tables -->
<cache
name="net.sf.hibernate.cache.UpdateTimestampsCache"
maxElementsInMemory="5000"
eternal="false"
overflowToDisk="true">
</cache>
Quote:
- if not found in the Session cache than fetch the whole entity from the ResultSet (ignoring so the 2nd level cache - where the entity is available).
If not found, it will look in the 2nd level cache, provided everything is defined correctly.
Other than that, I'd suggest posting your hbm, cfg, ehcache files for futher help.