????3.?????????????
????evict(Class arg0?? Serializable arg1)???????????ID?????????????????????????????????????????
????sessionFactory.evict(Customer.class?? new Integer(1));
????evict(Class arg0)  ???????????г???????????????????????????????????????
????sessionFactory.evict(Customer.class);
????evictCollection(String arg0)  ???????????г???????????????????????????????????????????????
????sessionFactory.evictCollection("Customer.orders");
????4.?????????????
??????????????????
EHCache  org.hibernate.cache.EhCacheProvider
OSCache  org.hibernate.cache.OSCacheProvider
SwarmCahe  org.hibernate.cache.SwarmCacheProvider
JBossCache  org.hibernate.cache.TreeCacheProvider
<!-- EHCache???????hibernate.cfg.xml -->
<hibernate-configuration>
<session-factory>
<!-- ?????????????EHCache??Provider??-->
<property name="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider
</property>
<!-- ???"???????" -->
<property name="hibernate.cache.use_query_cache">
true
</property>
</session-factory>
</hibernate-configuration>
<!-- ehcache.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<ehcache>
<!--
???浽????·??
-->
<diskStore path="d:/ehcache"></diskStore>
<!--
???????
maxElementsInMemory : ??????д??????????????
eternal : ??????????????????
timeToIdleSeconds ?????????????????
timeToLiveSeconds ???????ж????????????????????????????????ж????
overflowToDisk ?????????????????浽????
-->
<defaultCache maxElementsInMemory="200" eternal="false"
timeToIdleSeconds="50" timeToLiveSeconds="60" overflowToDisk="true"></defaultCache>
<!--
???????????
???????????????????????????????????????
-->
<cache name="com.suxiaolei.hibernate.pojos.Order" maxElementsInMemory="200" eternal="false"
timeToIdleSeconds="50" timeToLiveSeconds="60" overflowToDisk="true"></cache>
</ehcache>
<!-- *.hbm.xml -->
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class>
<!-- ????ó????????????沢????????? read-only read-write nonstrict-read-write transactional-->
<cache usage="read-write"/>
</class>
</hibernate-mapping>
?????????????????????????????????????????????????????????????????????<cache>?????????????????????????hbm????б????????<class>?????????
<cache>????????Hibernate?????OID??
<hibernate-mapping>
<class name="com.suxiaolei.hibernate.pojos.Customer" table="customer">
<!-- ???????? -->
<id name="id" type="string">
<column name="id"></column>
<generator class="uuid"></generator>
</id>
<!-- ???????? -->
<property name="username" column="username" type="string"></property>
<property name="balance" column="balance" type="integer"></property>
<set name="orders" inverse="true" cascade="all" lazy="false" fetch="join">
<cache usage="read-only"/>
<key column="customer_id" ></key>
<one-to-many class="com.suxiaolei.hibernate.pojos.Order"/>
</set>
</class>
</hibernate-mapping>