I have a simple unit test where I execute the same NHibernate named query 2 times (different session each time) with the identical parameter. It's a simple int parameter, and since my query is a named query I assume these 2 calls are identical and the results should be cached.
In fact, I can see in my log that the results ARE being cached, but with different keys. So, my 2nd query results are never found in cache.
here's a snip from my log (note how the keys are different):
(first query) DEBUG NHibernate.Caches.SysCache2.SysCacheRegion [(null)] <(null)> - adding new data: key= [snipped]... parameters: ['809']; named parameters: {}@743460424 & value=System.Collections.Generic.List`1[System.Object]
(second query) DEBUG NHibernate.Caches.SysCache2.SysCacheRegion [(null)] <(null)> - adding new data: key=[snipped]... parameters: ['809']; named parameters: {}@704749285 & value=System.Collections.Generic.List`1[System.Object]
I have NHibernate set up to use the query cache. And I have these queries set to cacheable=true. Don't know where else to look. Anyone have any suggestions?
Thanks
-Mike