Hibernate version:
NHibernate 1.2.1
Name and version of the database you are using:
SQL Sever 2000
I have a few hql and sql statements of which the results should be saved in the cache. That works without problems. But if I insert/update/delete an entity where the corresponding db table is involved in these queries, the query cache keeps the old results. when I run one of these queries again, I retrieve the old results.
With the query cache disabled everything works as aspected, but I like to use the cache, because these queries are executed very often.
My configuration:
Code:
<property name="cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider,NHibernate.Caches.SysCache</property>
<property name="cache.use_second_level_cache">true</property>
<property name="cache.use_query_cache">true</property>
The query execution:
Code:
ArrayList l2 = (ArrayList)Session.CreateSQLQuery(
"SELECT ... FROM RIGHTS, ...")
.SetCacheable(true)
.SetCacheRegion("SecurityManager")
.List();
The corresponging class to the table RIGHTS is Right. When I insert a new Right (the session is flushed and the entity is persisted successfully!) and then execute the above query again, I get the results from the query cache, without the new Right :-(
Suggestions are welcome!! Thanks!