1 <hibernate-configuration>
2 <session-factory>
3
4 <property name="hibernate.connection.username">scott</property>
5 <property name="connection.password">tiger</property>
6 <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
7 <property name="connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>
8
9 <property name="show_sql">true</property>
10 <property name="format_sql">true</property>
11 <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
12
13 <property name="hbm2ddl.auto">update</property>
14
15 <property name="hibernate.connection.isolation">2</property>
16
17 <property name="hibernate.use_identifier_rollback">true</property>
18
19 <property name="hibernate.jdbc.batch_size">30</property>
20 <property name="hibernate.jdbc.fetch_size">100</property>
21
22 <!-- 启用二级缓存 -->
23 <property name="hibernate.cache.use_second_level_cache">true</property>
24 <!-- 配置使用二级缓存的产品 -->
25 <property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
26
27 <!-- 配置管理Session的方式 -->
28 <property name="hibernate.current_session_context_class">thread</property>
29
30 <mapping resource="com/hibernate/entities/Department.hbm.xml" />
31 <mapping resource="com/hibernate/entities/Employee.hbm.xml" />
32 <!--
33 <class-cache usage="read-write" class="com.hibernate.entities.Employee"/>
34 -->
35
36 <class-cache usage="read-write" class="com.hibernate.entities.Department"/>
37 <collection-cache usage="read-write" collection="com.hibernate.entities.Department.employees"/>
38 </session-factory>
39 </hibernate-configuration>