首页 > 代码库 > hibernate核心文件配置(位置固定src下面 名称hibernate.cfg.xml)

hibernate核心文件配置(位置固定src下面 名称hibernate.cfg.xml)

<?xml version=‘1.0‘ encoding=‘UTF-8‘?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>

<session-factory>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/book1
</property>
<property name="connection.username">root</property>
<property name="connection.password">123456</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="myeclipse.connection.profile">Test</property>
<!-- getCurentSsssion的session的上下文 -->
<property name="current_session_context_class">thread</property>
<!-- 二级缓存 -->
<property name="cache.use_second_level_cache">true</property>
<property name="hibernate.cache.region.factory_class">
org.hibernate.cache.ehcache.EhCacheRegionFactory
</property>
<property name="javax.persistence.validation.mode">none</property>
<!--查询缓存 -->
<property name="cache.use_query_cache">true</property>
<mapping resource="com/yuntu/entity/Booktype.hbm.xml" />
<mapping resource="com/yuntu/entity/Book.hbm.xml" />

</session-factory>

</hibernate-configuration>

hibernate核心文件配置(位置固定src下面 名称hibernate.cfg.xml)