Hi,

I can't seem to get query caching to work for me, or else I'm
misunderstanding how it should work.

The following test:

[Test]
        public void Test()
        {
            var person = PersonBuilder.New().Build();
            _session.Save(person);
            _session.Flush();

            var query = _session.CreateCriteria<Person>()
                .Add(Restrictions.Eq("Id", person.Id))
                .SetCacheable(true);

            var listOne = query.List();
            var listTwo = query.List();
        }

causes two queries to the db, and in the session factory statistics I
can see that there have been 2 QueryCachePuts and 2 QueryCacheMisses,
and no QueryCacheHits.

I would have hoped that the first query would execute, and the second
hit the cache.  Is that correct or am I missing something?

My config file has these lines:

<property
name="cache.provider_class">NHibernate.Cache.HashtableCacheProvider</
property>
    <property name="cache.use_second_level_cache">true</property>
    <property name="cache.use_query_cache">true</property>

Thanks,
Matt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to