<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- 配置数据库连接 -->
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- 配置数据源 -->
<property name="hibernate.c3p0.max_size">50</property>
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.acquire_increment">5</property>
<property name="hibernate.c3p0.max_statements">200</property>
<property name="hibernate.c3p0.idle_test_period">3000</property>
<property name="hibernate.c3p0.validate">false</property>
<property name="hibernate.c3p0.timeout">5000</property>
<!-- 是否打印SQL语句 -->
<property name="hibernate.show_sql">true</property>
<!-- 注册映射关系 -->
<mapping resource="vo/User.hbm.xml"/>
<mapping resource="vo/Login.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Hibernate连接mysql数据库配置文件
最新推荐文章于 2021-03-04 04:05:49 发布
本文详细介绍了如何使用Hibernate配置文件设置与MySQL数据库的连接,包括数据库连接参数、数据源配置、SQL语句显示以及映射关系注册。
2028

被折叠的 条评论
为什么被折叠?



