I try to cache an aggregate consisting of a root object and a
collection of children in the second level cache. I manage to cache
the root entity in the cache but the child collection does not seem to
bee cached. In the mapping file(s) I explicitly add the <cache>
element to the collection and the child element and the config file
contains the necessary entries to enable 2nd level caching.
What am I missing?

 My config file (using sql server compact edition and the Hashtable
Cache Provider [for testing purposes only])

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
  <session-factory>
    <property
name="connection.provider">NHibernate.Connection.DriverConnectionProvider</
property>
    <property name="dialect">NHibernate.Dialect.MsSqlCeDialect</
property>
    <property
name="connection.driver_class">NHibernate.Driver.SqlServerCeDriver</
property>
    <property name="connection.connection_string">Data
Source=CachingSample.sdf</property>
    <property name="use_outer_join" >true</property>

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

    <property name="show_sql">true</property>
  </session-factory>
</hibernate-configuration>

the mapping file for my aggregate (the usual sample Blog-->Posts)

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   namespace="Caching"
                   assembly="Caching">
  <class name="Blog">
    <cache usage="read-write"/>
    <id name="Id">
      <generator class="hilo"/>
    </id>
    <property name="Author"/>
    <property name="Name"/>
    <set name="Posts" cascade="all" lazy="true">
      <cache usage="read-write"/>
      <key column="BlogId"/>
      <one-to-many class="Post"/>
    </set>
  </class>

  <class name="Post">
    <cache usage="read-write"/>
    <id name="Id">
      <generator class="hilo"/>
    </id>
    <property name="Title"/>
    <property name="Body"/>
  </class>
</hibernate-mapping>


--~--~---------~--~----~------------~-------~--~----~
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