- 浏览: 1754816 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (528)
- java基础 (35)
- oracle (23)
- 项目管理 (10)
- 代码架构 (27)
- java线程与进程 (2)
- 盈利模式 (10)
- 性能测试 (1)
- Ophone (2)
- web (6)
- asp (0)
- php (1)
- c# (1)
- Ruby (0)
- jboss (4)
- java基础之面试篇 (7)
- 数据查询优化 (1)
- weblogic (3)
- EJB (1)
- EXT (6)
- jquery (8)
- struts2 (2)
- struts1 (1)
- css (1)
- javascript (4)
- SSI (9)
- linux (9)
- c++ (6)
- 网络安全 (3)
- swing (2)
- 嵌入式 (1)
- 图像处理(机器人智能技术) (1)
- vb (2)
- mysql (2)
- sqlserver (10)
- dephi (0)
- Android (4)
- hadoop (1)
- maven (4)
- mybatis (1)
- html5 (1)
- 算法 (0)
- 高并发架构总结 (1)
- 时事评论 (4)
- 有些话不能不说 (35)
- 琴棋书画 (0)
- 教育 (1)
- 创业需要的 (4)
- 产品经理需要的 (4)
- 小南那些青涩的文章 (9)
- 如何创新 (4)
- 历史借鉴之秦汉 (1)
- 历史借鉴之三国 (1)
- 历史借鉴之魏晋 (1)
- 历史借鉴之隋唐 (1)
- 历史借鉴之南北宋 (1)
- 历史借鉴之近现代史 (1)
- 好工具我来推荐 (4)
- 汇编 (14)
最新评论
-
bilimeng:
求教,ConcurrentHashMap不是线程安全的么,为啥 ...
架构师之jdk8-----------------ConcurrentHashMap快速构建本地缓存和单例模式 -
baiducctv5:
wtaisi 写道wtaisi 写道|||||||||
spring aop中的propagation的7种配置的意思 -
zhangdong92:
另外内存泄漏一般也不是指计算时溢出。而是指某些对象已经不再使用 ...
java基础之面试篇三---int,float,long,double取值范围,内存泄露 -
zhangdong92:
Long.MAX_VALUE应该是(2^63)-1,而不是64 ...
java基础之面试篇三---int,float,long,double取值范围,内存泄露 -
nannan408:
java-lxm 写道好湿好湿好湿谢谢: )。
游南巅之晚秋
hibernate的缓存分为一级缓存和二级缓存,一级二级和我们常说的cpu的一级二级是不一样的。这里的一级说的是session的缓存,是hibernate内置的,不能卸载。二级说的是SessionFactory中的外置缓存,SessionFactory的内置缓存是放映射数据和sql语句的,程序不能更改,也不算二级缓存。二级缓存可以配置和更改,并且动态加载和卸载。Hibernate还为查询结果提供了一个查询缓存,它依赖于第二级缓存。
二. 一级缓存的管理:当应用程序调用Session的save()、update()、savaeOrUpdate()、get()或load(),以及调用查询接口的 list()、iterate()或filter()方法时,如果在Session缓存中还不存在相应的对象,Hibernate就会把该对象加入到第一级缓存中。当清理缓存时,Hibernate会根据缓存中对象的状态变化来同步更新数据库。 Session为应用程序提供了两个管理缓存的方法: evict(Object obj):从缓存中清除参数指定的持久化对象。 clear():清空缓存中所有持久化对象。
三. Hibernate二级缓存的管理:
1. Hibernate二级缓存策略的一般过程如下:
1) 条件查询的时候,总是发出一条select * from table_name where …. (选择所有字段)这样的SQL语句查询数据库,一次获得所有的数据对象。
2) 把获得的所有数据对象根据ID放入到第二级缓存中。
3) 当Hibernate根据ID访问数据对象的时候,首先从Session一级缓存中查;查不到,如果配置了二级缓存,那么从二级缓存中查;查不到,再查询数据库,把结果按照ID放入到缓存。
4) 删除、更新、增加数据的时候,同时更新缓存。Hibernate二级缓存策略,是针对于ID查询的缓存策略,对于条件查询则毫无作用。为此,Hibernate提供了针对条件查询的Query Cache。
2. 什么样的数据适合存放到第二级缓存中?
1) 很少被修改的数据
2) 不是很重要的数据,允许出现偶尔并发的数据
3) 不会被并发访问的数据
4) 参考数据,指的是供应用参考的常量数据,它的实例数目有限,它的实例会被许多其他类的实例引用,实例极少或者从来不会被修改。
3. 不适合存放到第二级缓存的数据?
1) 经常被修改的数据
2) 财务数据,绝对不允许出现并发
3) 与其他应用共享的数据。
4. 常用的缓存插件 Hibernater二级缓存是一个插件,下面是几种常用的缓存插件:
◆EhCache:可作为进程范围的缓存,存放数据的物理介质可以是内存或硬盘,对Hibernate的查询缓存提供了支持。
◆OSCache:可作为进程范围的缓存,存放数据的物理介质可以是内存或硬盘,提供了丰富的缓存数据过期策略,对Hibernate的查询缓存提供了支持。
◆SwarmCache:可作为群集范围内的缓存,但不支持Hibernate的查询缓存。
◆JBossCache:可作为群集范围内的缓存,支持事务型并发访问策略,对Hibernate的查询缓存提供了支持。
◆memcached
◆redis
四、如何配置二级缓存
4.1如果采用ehcached,配置如下:
4.1.1 将相应的二级缓存组件jar包导入到classpath类路径下
4.1.2在hibernate.cfg.xml文件中配置如下的信息:
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="cache.use_second_level_cache">true</property>
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
4.1.3. 指定哪些对象选要被缓存:这里既可以在hibernate.cfg.xml文件中配置,也可以在对应的hbm文件中配置
4.1.3.1 hibernate.cfg.xml文件中配置如下:
指定需要缓存的对象类型:这里可以在映射文件中配置,也可以在hibernate核心配置文件中进行配置
<class-cache class="com.hib.entity.Inf" usage="read-only" />
4.1.3.2 hbm文件中配置如下:
<cache usage="read-only"/> 在需要缓存的元素下添加<cache>元 素,根据需求使用相应的缓存级别
4.1.4. 在src目录下编写一个ehcache.xml文件,配置一些基本的缓存信息:
一般配置信息如下:
<?xml version="1.0" encoding="utf-8"?>
<ehcache>
<diskStore path="D:/ehcache"/><!--如果缓存中的对象存储超过指定的缓存数量的对象存储的磁盘地址-->
<!--全部默认的配置
maxElementsInMemory在內存中最多存放多少个对象
eternal对象是不是永远不变的,一般都是false
timeToLiveSeconds如果这个对象超过了这个时间,就会从缓存中清除
-->
<defaultCache
maxElementsInMemory="500"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
/>
<!-- 针对指定的对象使用的缓存配置
name表示的是缓存的类对象的全路径名 -->
<cache name="com.hibernate.Student"
maxElementsInMemory="500"
eternal="false"
timeToIdleSeconds="50"
timeToLiveSeconds="50"
overflowToDisk="true"
/>
</ehcache>
4.1.3.5如果有spring,那么spring中的配置
4.1.3.5.1.在类路径上ehcache.xml:
<ehcache>
<!-- Sets the path to the directory where cache .data files are created.
If the path is a Java System Property it is replaced by
its value in the running VM.
The following properties are translated:
user.home - User's home directory
user.dir - User's current working directory
java.io.tmpdir - Default temp file path -->
<diskStore path="java.io.tmpdir"/>
<!--Default Cache configuration. These will applied to caches programmatically created through
the CacheManager.
The following attributes are required:
maxElementsInMemory - Sets the maximum number of objects that will be created in memory
eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the
element is never expired.
overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache
has reached the maxInMemory limit.
The following attributes are optional:
timeToIdleSeconds - Sets the time to idle for an element before it expires.
i.e. The maximum amount of time between accesses before an element expires
Is only used if the element is not eternal.
Optional attribute. A value of 0 means that an Element can idle for infinity.
The default value is 0.
timeToLiveSeconds - Sets the time to live for an element before it expires.
i.e. The maximum time between creation time and when an element expires.
Is only used if the element is not eternal.
Optional attribute. A value of 0 means that and Element can live for infinity.
The default value is 0.
diskPersistent - Whether the disk store persists between restarts of the Virtual Machine.
The default value is false.
diskExpiryThreadIntervalSeconds- The number of seconds between runs of the disk expiry thread. The default value
is 120 seconds.
-->
<defaultCache
maxElementsInMemory="10000"
eternal="false"
overflowToDisk="true"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"/>
<!-- See http://ehcache.sourceforge.net/documentation/#mozTocId258426 for how to configure caching for your objects -->
</ehcache>
4.1。3.5.2.applicationContext-hibernate.xml里Hibernate SessionFactory配置:
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="configLocation"><value>classpath:hibernate.cfg.xml</value></property>
<!-- The property below is commented out b/c it doesn't work when run via
Ant in Eclipse. It works fine for individual JUnit tests and in IDEA ??
<property name="mappingJarLocations">
<list><value>file:dist/appfuse-dao.jar</value></list>
</property>
-->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">@HIBERNATE-DIALECT@</prop>
<!--<prop key="hibernate.show_sql">true</prop>-->
<prop key="hibernate.max_fetch_depth">3</prop>
<prop key="hibernate.hibernate.use_outer_join">true</prop>
<prop key="hibernate.jdbc.batch_size">10</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.use_sql_comments">false</prop>
-->
<!-- Create/update the database tables automatically when the JVM starts up
<prop key="hibernate.hbm2ddl.auto">update</prop> -->
<!-- Turn batching off for better error messages under PostgreSQL
<prop key="hibernate.jdbc.batch_size">0</prop> -->
</props>
</property>
<property name="entityInterceptor">
<ref local="auditLogInterceptor"/>
</property>
</bean>
启用class缓存:
4.2其他缓存和spring也是差不多,基本上是导包,自身缓存配置,spring配置加上true.
二. 一级缓存的管理:当应用程序调用Session的save()、update()、savaeOrUpdate()、get()或load(),以及调用查询接口的 list()、iterate()或filter()方法时,如果在Session缓存中还不存在相应的对象,Hibernate就会把该对象加入到第一级缓存中。当清理缓存时,Hibernate会根据缓存中对象的状态变化来同步更新数据库。 Session为应用程序提供了两个管理缓存的方法: evict(Object obj):从缓存中清除参数指定的持久化对象。 clear():清空缓存中所有持久化对象。
三. Hibernate二级缓存的管理:
1. Hibernate二级缓存策略的一般过程如下:
1) 条件查询的时候,总是发出一条select * from table_name where …. (选择所有字段)这样的SQL语句查询数据库,一次获得所有的数据对象。
2) 把获得的所有数据对象根据ID放入到第二级缓存中。
3) 当Hibernate根据ID访问数据对象的时候,首先从Session一级缓存中查;查不到,如果配置了二级缓存,那么从二级缓存中查;查不到,再查询数据库,把结果按照ID放入到缓存。
4) 删除、更新、增加数据的时候,同时更新缓存。Hibernate二级缓存策略,是针对于ID查询的缓存策略,对于条件查询则毫无作用。为此,Hibernate提供了针对条件查询的Query Cache。
2. 什么样的数据适合存放到第二级缓存中?
1) 很少被修改的数据
2) 不是很重要的数据,允许出现偶尔并发的数据
3) 不会被并发访问的数据
4) 参考数据,指的是供应用参考的常量数据,它的实例数目有限,它的实例会被许多其他类的实例引用,实例极少或者从来不会被修改。
3. 不适合存放到第二级缓存的数据?
1) 经常被修改的数据
2) 财务数据,绝对不允许出现并发
3) 与其他应用共享的数据。
4. 常用的缓存插件 Hibernater二级缓存是一个插件,下面是几种常用的缓存插件:
◆EhCache:可作为进程范围的缓存,存放数据的物理介质可以是内存或硬盘,对Hibernate的查询缓存提供了支持。
◆OSCache:可作为进程范围的缓存,存放数据的物理介质可以是内存或硬盘,提供了丰富的缓存数据过期策略,对Hibernate的查询缓存提供了支持。
◆SwarmCache:可作为群集范围内的缓存,但不支持Hibernate的查询缓存。
◆JBossCache:可作为群集范围内的缓存,支持事务型并发访问策略,对Hibernate的查询缓存提供了支持。
◆memcached
◆redis
四、如何配置二级缓存
4.1如果采用ehcached,配置如下:
4.1.1 将相应的二级缓存组件jar包导入到classpath类路径下
4.1.2在hibernate.cfg.xml文件中配置如下的信息:
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="cache.use_second_level_cache">true</property>
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
4.1.3. 指定哪些对象选要被缓存:这里既可以在hibernate.cfg.xml文件中配置,也可以在对应的hbm文件中配置
4.1.3.1 hibernate.cfg.xml文件中配置如下:
指定需要缓存的对象类型:这里可以在映射文件中配置,也可以在hibernate核心配置文件中进行配置
<class-cache class="com.hib.entity.Inf" usage="read-only" />
4.1.3.2 hbm文件中配置如下:
<cache usage="read-only"/> 在需要缓存的元素下添加<cache>元 素,根据需求使用相应的缓存级别
4.1.4. 在src目录下编写一个ehcache.xml文件,配置一些基本的缓存信息:
一般配置信息如下:
<?xml version="1.0" encoding="utf-8"?>
<ehcache>
<diskStore path="D:/ehcache"/><!--如果缓存中的对象存储超过指定的缓存数量的对象存储的磁盘地址-->
<!--全部默认的配置
maxElementsInMemory在內存中最多存放多少个对象
eternal对象是不是永远不变的,一般都是false
timeToLiveSeconds如果这个对象超过了这个时间,就会从缓存中清除
-->
<defaultCache
maxElementsInMemory="500"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
/>
<!-- 针对指定的对象使用的缓存配置
name表示的是缓存的类对象的全路径名 -->
<cache name="com.hibernate.Student"
maxElementsInMemory="500"
eternal="false"
timeToIdleSeconds="50"
timeToLiveSeconds="50"
overflowToDisk="true"
/>
</ehcache>
4.1.3.5如果有spring,那么spring中的配置
4.1.3.5.1.在类路径上ehcache.xml:
<ehcache>
<!-- Sets the path to the directory where cache .data files are created.
If the path is a Java System Property it is replaced by
its value in the running VM.
The following properties are translated:
user.home - User's home directory
user.dir - User's current working directory
java.io.tmpdir - Default temp file path -->
<diskStore path="java.io.tmpdir"/>
<!--Default Cache configuration. These will applied to caches programmatically created through
the CacheManager.
The following attributes are required:
maxElementsInMemory - Sets the maximum number of objects that will be created in memory
eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the
element is never expired.
overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache
has reached the maxInMemory limit.
The following attributes are optional:
timeToIdleSeconds - Sets the time to idle for an element before it expires.
i.e. The maximum amount of time between accesses before an element expires
Is only used if the element is not eternal.
Optional attribute. A value of 0 means that an Element can idle for infinity.
The default value is 0.
timeToLiveSeconds - Sets the time to live for an element before it expires.
i.e. The maximum time between creation time and when an element expires.
Is only used if the element is not eternal.
Optional attribute. A value of 0 means that and Element can live for infinity.
The default value is 0.
diskPersistent - Whether the disk store persists between restarts of the Virtual Machine.
The default value is false.
diskExpiryThreadIntervalSeconds- The number of seconds between runs of the disk expiry thread. The default value
is 120 seconds.
-->
<defaultCache
maxElementsInMemory="10000"
eternal="false"
overflowToDisk="true"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"/>
<!-- See http://ehcache.sourceforge.net/documentation/#mozTocId258426 for how to configure caching for your objects -->
</ehcache>
4.1。3.5.2.applicationContext-hibernate.xml里Hibernate SessionFactory配置:
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="configLocation"><value>classpath:hibernate.cfg.xml</value></property>
<!-- The property below is commented out b/c it doesn't work when run via
Ant in Eclipse. It works fine for individual JUnit tests and in IDEA ??
<property name="mappingJarLocations">
<list><value>file:dist/appfuse-dao.jar</value></list>
</property>
-->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">@HIBERNATE-DIALECT@</prop>
<!--<prop key="hibernate.show_sql">true</prop>-->
<prop key="hibernate.max_fetch_depth">3</prop>
<prop key="hibernate.hibernate.use_outer_join">true</prop>
<prop key="hibernate.jdbc.batch_size">10</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.use_sql_comments">false</prop>
-->
<!-- Create/update the database tables automatically when the JVM starts up
<prop key="hibernate.hbm2ddl.auto">update</prop> -->
<!-- Turn batching off for better error messages under PostgreSQL
<prop key="hibernate.jdbc.batch_size">0</prop> -->
</props>
</property>
<property name="entityInterceptor">
<ref local="auditLogInterceptor"/>
</property>
</bean>
启用class缓存:
4.2其他缓存和spring也是差不多,基本上是导包,自身缓存配置,spring配置加上true.
发表评论
-
架构师之jdk8-----------------ConcurrentHashMap快速构建本地缓存和单例模式
2015-06-04 15:33 90481.前言。 本地缓存和复杂的单例写起来不仅效率低下,而且 ... -
架构师之jdk8-------------------集合互相转换集锦
2015-06-04 11:34 16121.前言. 如题.这里主要介绍list,map等常用集合的 ... -
架构师之hibernate-------------------mysql类型对应java转换
2015-06-02 18:29 16361.前言. 如题. 2.代码. Hibernat ... -
架构师之bean---------------bean之间的数据copy
2015-06-01 18:05 14351.前言. 如题,bean不能强转,只能对应转换.一共有 ... -
架构师之jetty使用----------------问题集锦
2015-05-27 10:11 14211.前言. 如题. 2.问题描述. (1)com.op ... -
架构师之json-----------通过path查找指定数据
2015-03-31 14:29 26231.前言 如题。 2.代码. imp ... -
架构师之mybatis-----timestamp转date丢失精度问题
2015-03-26 14:53 45361.前言. 如题. 2.问题描述. 如果mappe ... -
架构师之数字判断-----------------怎么判断一个字符串是个数字
2015-03-24 14:43 9541.前言. 如题. 2.代码. 方法1: publ ... -
架构师之enum枚举之(二)--------直接判断String是否属于枚举中的一个
2015-03-22 21:17 82511.前言。 如题。 2.代码。 enum E ... -
架构师之jdk的bug排查(一)---------------split的点号陷阱
2015-03-20 15:01 33461.前言. jdk1.6的lang包的split方法是有 ... -
架构师之enum枚举之(一)-----------如何判断枚举和字符串相等(最简便方法)
2015-03-20 10:47 80681.前言. 如题. 2.代码. (1)代码串 publ ... -
架构师之maven(三)---------junit测试可能遇到的问题
2015-03-18 10:31 17841.前言. 如题. 2.代码. (1)类型转换错误 (1) ... -
架构师之maven(二)junit4.11+spring4.1的测试配置
2015-03-16 17:15 36901.前言. maven的junit测试是需要遵守一些规则 ... -
spring官方下载地址
2015-03-16 10:10 1125SPRING官方网站改版后,建议都是通过 Maven和Grad ... -
java 序列化和反序列化(针对字符串的例子)
2014-11-04 14:09 42211.前言. 摘自:http://blog.csdn.ne ... -
架构师之Dos命令之setx-------常用来设置系统环境变量
2014-08-25 10:19 73281.前言。 如题。 2.内容。 用法为形如 @SET ... -
linux集群之----------设置磁盘缓冲参数
2014-07-29 10:59 70641.前言。 如题。linux ... -
spark+hadoop+cenos6.5+VitualBox4.3.6整合开发(一)安装centos6.5
2014-01-17 10:04 32681.前言。 首先先感谢cctv和http://zhou ... -
axis2-如何已知uri或者xml生成客户端?
2013-11-06 10:23 26911.前言 首先,需要下载axis2工具包,见附件,我这里是 ... -
让ie6,7,8支持canvas,css3等主流html5技术
2013-06-18 13:02 293471.前言。 ie6,7,8支持htm ...
相关推荐
hibernate一级缓存和二级缓存的区别与联系
主要讲解hibernate缓存的配置和和使用方法,以及一级缓存和二级缓存的定义和区别,和查询缓存的使用
Hibernate 一级缓存和二级缓存的区别
Hibernate一级缓存、二级缓存以及查询缓存实例
hibernate的一级缓存和二级缓存,hibernate的一级缓存和二级缓存,hibernate的一级缓存和二级缓存,hibernate的一级缓存和二级缓存,hibernate的一级缓存和二级缓存
NULL 博文链接:https://cdxs2.iteye.com/blog/1936594
一对一映射 hibernate优化配置一级二级缓存步骤 有图有真相
NULL 博文链接:https://12345678.iteye.com/blog/721910
用以介绍hibernate 框架的缓存机制
Hibernate一级缓存和二级缓存【内附二级缓存数据存储结构】
NULL 博文链接:https://364232252.iteye.com/blog/2369161
Hibernate二级缓存 在一个数据库系统中,如果缓存设置的合适,那么可以极大的提高系统的效率,Hibernate作为一个ORM工具 提供了缓存的机制,包括一级(Session级)缓存和二级(SessionFactory级)缓存。这里主要...
Hibernate中提供了两级Cache,第一级别的缓存是Session级别的缓存,它是属于事务范围的缓存。这一级别的缓存由hibernate管理的,一般情况下无需进行... Hibernate还为查询结果提供了一个查询缓存,它依赖于第二级缓存
它可以使用不同的缓存实现,如 EhCache 、 JBossCache 、 OsCache 等 (二级缓存是缓存实体对象的) 还有一个类型的 CACHE 就是 QueryCache . 它的作用就是缓存一个 Query 以及 Query 返回对象的 Identifier 以及...
详细描述了,Hibernate中一级缓存和二组缓存的思想思路,以及使用方法,使用情况。
做一个hibernate 二级缓存的例子,其中都已经加了注释,一看就明白,数据库需要自己建
今天小编就为大家分享一篇关于Hibernate一级缓存和二级缓存详解,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
文件中是一个简单的SSH集成,带hibernate二级缓存,有点烂,但是初学者还是可以看看数据库是sqlserver,代码齐全,有sql脚本,部署到tomcat就可以跑
Hibernate允许在类和集合的粒度上设置第二级缓存。在映射文件中,和元素都有一个子元素,这个子元素用来配置二级缓存。 示例:以category(产品类别)和product(产品)的映射为例: 1) 修改要配置缓存的那个持久化类的...
使用Java工程实现了Hibernate二级缓存(Ehcache),其中还有自己封装的一个jar包实现了简单的分页功能