rajoos2004 wrote:
I am assuming that my query results are cached since the response in the loop is faster the second time.
I wouldn't "assume" that. It could equally well be due to the fact that the second time the actual on-disk data is found in the operating system buffers, or that the DB itself is doing some caching.
Quote:
At this point i do not have "ehcache-0.6.jar" in my class path. Does this mean Cache is really working ? if so, using what type of cache ? I just some theoritical explanation.
You mentioned that you have configured hibernate to use HashtableCacheProvider, so I assume that Hibernate would thus use the built-in HashtableCache. AFAIK HashtableCache is basically a toy which shouldn't be used for other than testing purposes. You can check that the cache is actually working by putting the line
Code:
log4j.logger.net.sf.hibernate.cache=debug
in your log4j.properties file and watching the log output.
Quote:
Now i want to try EHCache too. Can you give me steps to set up EHCache ?
Put ehcache-x.y.jar in the classpath, and configure the ehcache.xml file.
Quote:
I would like to set "maxElementsInMemory=1", overflowToDisk="true" and actually see the objects are written to disk.
Then do that, if that is what you want to do. No need to ask for permission.
Quote:
I am looking for some example please.
The ehcache website contains some documentation about how to set it up.