This is a quick lesson learned post, but it might also be a bug.
If you are trying to map Hibernate Objects into JBoss TreeCache regions, the translation between names is not exactly obvious.
If you have the following cache settings in hibernate.cfg.xml:
Code:
<property name="hibernate.cache.provider_class">org.hibernate.cache.TreeCacheProvider</property>
<class-cache class="org.dummy.Company" usage="transactional" />
<class-cache class="org.dummy.User" usage="transactional" />
<collection-cache collection="org.dummy.Company.users" usage="transactional" />
You can control TreeCache regions in treecache.xml like so:
Code:
<!-- Name of the eviction policy class. -->
<attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
<attribute name="EvictionPolicyConfig">
<config>
<attribute name="wakeUpIntervalSeconds">5</attribute>
<!-- Cache wide default -->
<!-- Zero is no limit on maxNodes and timeToLiveSeconds -->
<region name="/_default_">
<attribute name="maxNodes">200</attribute>
<attribute name="timeToLiveSeconds">0</attribute>
</region>
<!-- specific regions-->
<region name="//org/dummy/Company/users">
<attribute name="maxNodes">1000</attribute>
<attribute name="timeToLiveSeconds">0</attribute>
</region>
<region name="//org/dummy/Company">
<attribute name="maxNodes">100</attribute>
<attribute name="timeToLiveSeconds">0</attribute>
</region>
<region name="//org/dummy/User">
<attribute name="maxNodes">1000</attribute>
<attribute name="timeToLiveSeconds">0</attribute>
</region>
</config>
</attribute>
Notice the double
// at the beginning of the treecache region name. This may be a bug, but that's how it's currently working in Hibernate 3.0.1.