I have a very specific question regarding the underlying implementation of the QueryCache (via 2nd level cache) and SessionFactory instances.
Currently, we have a persistence layer that initializes and configures nhibernate for all of our web apps. So they all share the same initialization code. We are also utilizing second level caching, in particular the query caches. What I have found though is that for each of the webapps, when they send the same sql, I was expecting if the query was cached by one web application, then the other web application would not query the database and retrieve the entities from the 2nd level cache, but this seems to be not the case. I know that QueryCaches are unique to SessionFactory, so this may be why I'm seeing this behavior. My question is how can I share or ensure that one session factory is created/used for all of the different web applications. Thanks in advance!
