1. opensymphony
  2. oscache


oscache / docs / hibernate.html

        <title>OSCache and Hibernate</title>


        <p><a href="http://www.hibernate.org">Hibernate</a> is a powerful, ultra-high
        performance object/relational persistence and query service for Java.
        Hibernate lets you develop persistent objects following common Java idiom -
        including association, inheritance, polymorphism, composition and the Java
        collections framework. Extremely fine-grained, richly typed object models
        are possible.</p>
        <p>Hibernate 2.1 features support for plugin cache providers and is 
        designed to integrate with distributed caches (2.1 also implements more 
        aggressive use of the cache). 
        <b>net.sf.hibernate.cache.CacheProvider</b> is the extension point for 
        user-defined cache integration.</p>
        <p><a href="http://www.hibernate.org/6.html">Hibernate 2.1.1</a> or 
        higher is required.</p>        

        <p>OSCache and Hibernate 2.1 integrate though <b>OSCacheProvider</b>. To 
        enable OSCache in Hibernate's configuration, add the following line to 

&lt;property name="hibernate.cache.provider_class"&gt;<b>net.sf.hibernate.cache.OSCacheProvider</b>&lt;/property&gt;

        <p>The default refresh period is 
        <a href="http://www.opensymphony.com/oscache/api/com/opensymphony/oscache/base/CacheEntry.html#INDEFINITE_EXPIRY">CacheEntry.INDEFINITE_EXPIRY</a>.
        The first time a cacheable query is done, the cache has no effect on 
        speed. On the second and successive queries, the cache will be populated 
        and available to be hit.</p>
        <p>NOTE: object identifiers must have well-behaved <tt>toString()</tt> methods.</p>


        <p>To modify the refresh period, CRON expression or maximum cache 
        capacity, add the region configuration to your oscache.properties file, 
        as demonstrated below:</p>
com.mypackage.model.Customer.refresh.period = 4000
com.mypackage.model.Customer.cron = * * 31 Feb *
com.mypackage.model.Customer.capacity = 500

        <p>The <code>com.mypackage.model.Customer</code> is Hibernate's internal 
        <b>cache region</b>, which defaults to the classname, but which can be 
        specified in the Hibernate mapping files (region attribute of class-
        cache element or collection-cache element).</p>