java/j2ee tips and blueprints
java/j2ee tips and blueprints
It is a very sad thing that nowadays
there is so little useless information.
Oscar Wilde
hibernate cache injection: missing…
currently hibernate version is 3.2.5 and there is still something basic missing: cache injection.
while you are using spring or another container you can configure hibernate by injection. e.g:your own datasource definition,your dialect , your hibernate interceptors.
but you can not inject your caching mechanism because hibernate only accept hibernate.cache.provider_class
Result: you can not share your caching mechanism with hibernate or manage hibernate caching mechanism.
<bean id=“MySessionFactory”class=“org.springframework.orm.hibernate3.LocalSessionFactoryBean”>
<property name=“mappingResources”>
<list>
<value>mappings/Book.hbm.xml</value>
<value>mappings/Patron.hbm.xml</value>
<value>mappings/BorrowRecord.hbm.xml</value>
</list>
</property>
<property name=“hibernateProperties”>
<props>
<prop key=“hibernate.dialect”>org.hibernate.dialect.MySQLDialect</prop>
<prop key=“hibernate.query.substitutions”>true=1false=0</prop>
<prop key=“hibernate.show_sql”>false</prop>
<prop key=“hibernate.use_outer_join”>false</prop>
</props>
</property>
<property name=“dataSource”><ref bean=“MyDataSource”/></property>
</bean>
some good idea to look : Caching the result of methods using Spring and EHCache












It should also be noted that as Spring has evolved, it has become even easier to integrate EHCache into method calls (than even the example in the link shows, which is quite old). Add three existing bean definitions to your app context, an XML config file for ehcache, some annotations on your cacheable methods, and you’re done. This means you can use ibatis or hibernate interchangeably without concern for data access mechanisms. You also get the established benefits of EHCache with regards to distributed caching, with no extra coding.
thanks Halcyon,
One more note,
this a feature request which is considerably easy and effective I guess
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3054