浏览 3257 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-12-04
<property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.generate_statistics">true</prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.use_second_level_cache">true</prop> <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> <prop key="hibernate.cache.configurationResourceName">ehcache.xml</prop> </props> </property> ehcache 配置 <defaultCache maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true" /> log4j 配置 log4j.category.net.sf.ehcache debug,FrameWorkEhCache log4j.appender.FrameWorkEhCache org.apache.log4j.DailyRollingFileAppender log4j.appender.FrameWorkEhCache.File ${system.logPath}/FrameWorkEhCache.log log4j.appender.FrameWorkEhCache.DatePattern yyyy-MM-dd'.log' log4j.appender.FrameWorkEhCache.layout org.apache.log4j.PatternLayout log4j.appender.FrameWorkEhCache.layout.ConversionPattern [%c]-[%p] %m%n log4j.appender.FrameWorkEhCache.append false 代码: public <E> List<E> getAll(String queryString) { // CL_TODO Auto-generated method stub HibernateTemplate template = this.getHibernateTemplate(); template.setCacheQueries(true); List<E> l = template.find(queryString); template.setCacheQueries(false); return l; } hbm文件 <cache usage="read-write"/> 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |