现在的位置: 首页 > 综合 > 正文

Hiberate的配置文件

2013年10月04日 ⁄ 综合 ⁄ 共 1246字 ⁄ 字号 评论关闭

hiberate的配置恩件主要有两个,一个是hiberate.properties,一个是hiberate.cfg.xml.我不明白的是,为什么在一个项目中要同时使用这两个配置文件,在hiberete.properties中的配置如下:
## MySQL
hibernate.dialect org.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc/:mysql/://localhost/:3306/Tre
hibernate.connection.username root
hibernate.connection.password root

在hiberate.cfg.xml中的配置如下:
<!DOCTYPE hibernate-configuration SYSTEM
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- NOTE: For Hibernate Session Factory Use Only -->
<hibernate-configuration>
<session-factory>
<property name="connection.pool_size">1</property>
<property name="show_sql">false</property>
<property name="format_sql">true</property>
<property name="cache.provider_class">
org.hibernate.cache.OSCacheProvider
</property>
<property name="cache.use_query_cache">true</property>
<property name="query.factory_class">
org.hibernate.hql.ast.ASTQueryTranslatorFactory
</property>
<property name="query.substitutions">
true 1, false 0, yes 'Y', no 'N'
</property>
<property name="proxool.pool_alias">pool1</property>
<property name="jdbc.batch_size">0</property>
<property name="jdbc.use_streams_for_binary">true</property>
<property name="max_fetch_depth">1</property>

</session-factory>
</hibernate-configuration>

抱歉!评论已关闭.