漫画:为什么不能打断程序员?
2013-10-29 23:07
489 查看
Hibernate comes with three different caches: first level, second level and query cache.
The first level cache is the Hibernate Session and is used to track the state of entities during the current Session (or unit of work). This is a transaction-level cache.
The second level cache shares entity state across various Session. This is a SessionFactory-level cache.
The query cache is used to cache queries (and their parameters) and their results.
steps to use cache
add ehcache dependency, enable following in conf
The Second Level Cache in the documentation
Hibernate: Truly Understanding the Second-Level and Query Caches
The first level cache is the Hibernate Session and is used to track the state of entities during the current Session (or unit of work). This is a transaction-level cache.
The second level cache shares entity state across various Session. This is a SessionFactory-level cache.
The query cache is used to cache queries (and their parameters) and their results.
steps to use cache
add ehcache dependency, enable following in conf
hibernate.cache.use_query_cache=true hibernate.cache.use_second_level_cache=true hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider ## If the cache is used in a JTA environment, you must specify the property ## Hibernate.transaction.manager_lookup_class and naming a strategy for obtaining the JTA TransactionManager. hibernate.transaction.manager_lookup_class=com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup put following tag in entities hibernate mapping file [code=xml] <!--details see office document--> <cache usage="transactional|read-write|nonstrict-read-write|read-only" /> <set> <cache usage="transactional|read-write|nonstrict-read-write|read-only" /> </set>
The Second Level Cache in the documentation
Hibernate: Truly Understanding the Second-Level and Query Caches
相关文章推荐
- 漫画:为什么不能打断程序员?
- 漫画:为什么不能打断程序员
- 漫画:为什么不能打断程序员?
- 漫画:为什么不能打断程序员?
- 漫画:为什么不能打断程序员?
- 为什么不能打断正在工作的程序员?
- [转]为什么不能打断程序员?
- 为什么程序员总是不能准确估测项目时间
- 漫画:为什么月薪5W的程序员活得像月薪5K?
- 程序员为什么要不能一次性写好,需要一直改bug ?
- 程序员为什么就不能朝九晚五?
- 为什么程序员总是不能准确估测项目时间
- 为什么程序员总是不能准确估测项目时间
- 为什么产品经理的工资不能比程序员高?
- 为什么程序员总是不能准确估测项目时间
- 为什么程序员不能接私活?
- 为什么优秀的程序员既懒又笨
- 为什么我在朋友圈只发表文字时不能选择表情呢?
- 作为程序员为什么一直都很努力,却没有进步?
- 为什么还有人雇佣糟糕的程序员?