-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate region name -> TreeCache region name
PostPosted: Thu Apr 28, 2005 3:25 pm 
Newbie

Joined: Fri Jan 14, 2005 2:53 pm
Posts: 7
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 28, 2005 3:34 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Ooops i kinda half noticed that but never really thought about why before....

It's fixed in CVS.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.