Hi All, I have been having issues with NHibernate’s 2nd level caching while using the SysCache2 provider. I am receiving a lot of random caching misses that are occurring roughly every 3-5 minutes or so. The 2nd level caching appears to be working when inspecting database calls through SQL profiler, i.e. for cached queries or entities, first time they are loaded into the 2nd level cache a query is sent and after that no query is sent until the next miss.
I am using what I believe is the latest version from the trunk of the SysCache2 provider (as of last week). I built the solution against a NHibernate version from more than a few months ago. I would really like to get this caching provider working because of the SQL Server Dependencies functionality. I’ve tried SysCache but that does not build against my NHibernate version. I’ve searched the net and found that some people are having the same problem but their solution did not work for me: https://forum.hibernate.org/viewtopic.php?p=2406601 Below are my settings and configurations: *Web.config* <section name="syscache2" type="NHibernate.Caches.SysCache2.SysCacheSection, NHibernate.Caches.SysCache2"/> <syscache2> <cacheRegion name="ReferenceData"> <dependencies> <tables> <add name="DomainObjectA" databaseEntryName="DatabaseName" tableName="dbo.DatabaseObjectA" /> <add name=" DomainObjectB " databaseEntryName=" DatabaseName" tableName="dbo. DatabaseObjectB" /> </tables> </dependencies> </cacheRegion> </syscache2> *Session Factory.config* <session-factory name=" DatabaseName"> <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</ property> <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</ property> <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</ property> <property name="cache.use_second_level_cache">true</property> <property name="cache.use_query_cache" >true</property> <property name="cache.provider_class">NHibernate.Caches.SysCache2.SysCacheProvider, NHibernate.Caches.SysCache2</property> <!--<property name="connection.connection_string_name">DatabaseConnectionString</ property>--> <property name="show_sql">false</property> <property name="generate_statistics">false</property> <property name="max_fetch_depth">1</property> <property name="connection.isolation">ReadCommitted</property> <property name="default_schema">dbo</property> <mapping assembly="AssemblyName.Repositories" /> </session-factory> </hibernate-configuration> *Mapping Files* ObjectA.hbm <class name="BusinessLogic.Domain.ObjectA, BusinessLogic.Domain" table="ObjectA" optimistic-lock="version"> <id name="Id" column ObjectAId" access="field.camelcase- underscore"> <generator class="identity" /> </id> <version name="Version" column="RowVersion" access="field.camelcase-underscore" /> <many-to-one name=" ObjectB" class="BusinessLogic.Domain.ObjectB, BusinessLogic.Domain" access="field.camelcase-underscore"> <column name=" ObjectBId" not-null="true" fetch="select" lazy="false"/> </many-to-one> <property> … <property /> </class> ObjectB.hbm <class name=" BusinessLogic.Domain.ObjectB, BusinessLogic.Domain " table="ObjectB" optimistic-lock="none" mutable="true"> <cache usage="read-only" region="ReferenceData"/> <id name="Id" column="ObjectBId" access="field.camelcase- underscore"> <generator class="assigned" /> </id> <property> … <property> </class> *Query Example* public List<ObjectB> GetObjectBReferenceData() { List<ObjectB> objectBs = new List<ObjectB>(); ICriteria critObjectBs = UnitOfWork.CurrentSession.CreateCriteria(typeof(ObjectB)) .SetCacheable(true); objectBs = critObjectBs.List<ObjectB>() as List<ObjectB>; return objectBs; } Please note that I am using Nhibernate version 2.0.1.X (where X is the latest from the trunk) as opposed to using Nhibernate 2.0.1.400 which has some serious memory leak issues: http://www.rasmuskl.dk/post/A-WinDbg-Debugging-Journey-NHibernate-Memory-Leak.aspx?dzref=142850 Any help or direction would be very much appreciated. Thanks, Joe Turcic Senior .NET Developer Email: [email protected] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "NHibernate Contrib - Development Group" 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.ar/group/nhcdevs?hl=en -~----------~----~----~----~------~----~------~--~---
