hibernate连接mysql配置文件
2015-05-08 11:17
239 查看
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- hibernate- configuration是连接配置文件的根元素-->
<hibernate-configuration>
<session-factory>
<!-- 指定连接数据库所用的驱动-->
<propertyname="connection.driver_class">com.mysql.jdbc.Driver</property>
<!--指定连接数据库的url,hibernate连接的数据库名 -->
<propertyname="connection.url">jdbc:mysql://localhost/slim</property>
<propertyname="connection.useUnicode">true</property>
<propertyname="connection.characterEncoding">gbk</property>
<!-- 指定连接数据库的用户名-->
<propertyname="connection.username">root</property>
<!-- 指定连接数据库的密码-->
<propertyname="connection.password">gyfbao</property>
<!--C3P0连接池设定-->
<propertyname="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<!-- 指定连接池里最大连接数-->
<propertyname="hibernate.c3p0.max_size">20</property>
<!-- 指定连接池里最小连接数-->
<propertyname="hibernate.c3p0.min_size">1</property>
<!-- 指定连接池里连接的超时时长-->
<propertyname="hibernate.c3p0.timeout">1800</property>
<!--指定连接池里最大缓存多少个Statement对象 -->
<propertyname="hibernate.c3p0.max_statements">100</property>
<propertyname="hibernate.c3p0.idle_test_period">500</property>
<propertyname="hibernate.c3p0.acquire_increment">2</property>
<propertyname="hibernate.c3p0.validate">true</property>
<propertyname="hibernate.c3p0.preferredTestQuery ">select 1</property>
<propertyname="hibernate.c3p0.idleConnectionTestPeriod">18000</property>
<propertyname="hibernate.c3p0.maxIdleTime">25000</property>
<propertyname="hibernate.c3p0.testConnectionOnCheckout">true</property>
<!-- 指定数据库方言-->
<propertyname="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
<!-- 根据需要自动创建数据库-->
<propertyname="hbm2ddl.auto">update</property>
<!-- 显示Hibernate持久化操作所生成的SQL-->
<propertyname="show_sql">true</property>
<!--将SQL脚本进行格式化后再输出-->
<propertyname="hibernate.format_sql">true</property>
<!-- 罗列所有的映射文件
<mappingresource="User.hbm.xml"/>
<mappingresource="Area.hbm.xml"/>
<mappingresource="Training.hbm.xml"/>
<mappingresource="School.hbm.xml"/>
<mappingresource="Figure.hbm.xml"/>
<mappingresource="Jobs.hbm.xml"/>
<mappingresource="Trabuy.hbm.xml"/>
<mappingresource="Schbuy.hbm.xml"/>
<mappingresource="Schfigure.hbm.xml"/>
<mappingresource="Profession.hbm.xml"/>
<mappingresource="Course.hbm.xml"/>
<mappingresource="Library.hbm.xml"/>
<mappingresource="MainCategories.hbm.xml"/>
<mappingresource="SecondaryCategories.hbm.xml"/>-->
<mappingresource="News.hbm.xml"/>
<mappingresource="NewContent.hbm.xml"/>
<mappingresource="Ask.hbm.xml"/>
<mappingresource="Answer.hbm.xml"/>
<mappingresource="About.hbm.xml"/>
<mappingresource="Item.hbm.xml"/>
</session-factory>
</hibernate-configuration>
相关文章推荐
- hibernate学习(一)hibernate.cfg.xml文件连接mySql、Oracle、SqlServer配置
- hibernate连接mysql配置文件
- hibernate连接mysql配置文件 分享
- hibernate连接mysql配置文件
- MySQL连接Hibernate配置properties文件内容
- hibernate连接mysql配置文件
- hibernate.cfg.xml配置文件,连接oracle数据库和mysql 数据库
- Hibernate配置文件连接Mysql
- hibernate连接mysql配置文件
- hibernate.cfg.xml文件连接mySql、Oracle、SqlServer配置
- hibernate连接多个数据库,如何动态切换(我一般用配置文件动态切换)
- 连接Oracle数据库的Hibernate配置文件
- mysql连接慢,修改配置文件
- hibernate.cfg.xml文件连接mySql、Oracle、SqlServer配置
- Java连接Mysql:通过配置文件
- Java通过配置文件连接Mysql和Oracle数据库
- ubuntu安装lamp&&mysql中修改配置文件显示中文&&强大的vim配置&&c++连接Mysql
- hibernate中连接SQLServer2008的配置文件hibernate.cfg.xml
- Hibernate数据库配置文件(mysql),注意字符集配置
- MySQL连接配置文件密码加密及其在多种连接池上的应用