2 Replies Latest reply on Feb 14, 2008 5:19 AM by Narendra Gupta

    Region based cachine (JBoss Cache + Hibernate)

    Narendra Gupta Newbie

      Hi,

      I am using JBoss cache as 2nd level cache in Hibernate.

      But I am trying to use region based caching, so that cache regions of different tables refresh in different time intervals.

      I have configured my settings as per below but cache is refreshing based on default region settings i.e.

      <region name="/_default_">


      Am I missing something?

      JBoss Cache configuration (region only)
      <region name="/SYSTEM_PARAMETER">
       <attribute name="maxNodes">50000</attribute>
       <attribute name="timeToLiveSeconds">7200</attribute>
       <attribute name="maxAgeSeconds">7200</attribute>
      </region>


      HIbernate configuration (hbm file)
      <hibernate-mapping package="com.shkco.nwte.common.datamodel">
       <class name="SystemParameter" table="SYSTEM_PARAMETER">
       <cache usage="read-only"/>
       ..
       </class>
      </hibernate-mapping>


      Java Code
      query.setCacheable(true);
      query..setCacheRegion("SYSTEM_PARAMETER");
      
      where query if of type "org.hibernate.Query"