<?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">
<hibernate-configuration>
<session-factory>
<!--数据库连接-->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql:///mybatis?useSSL=false</property>
<property name="connection.username">root</property>
<property name="connection.password">123456</property>
<!--dialect 方言-->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!--数据库连接池 C3P0 添加C3P0依赖-->
<property name="c3p0.max_size">2</property>
<property name="c3p0.min_size">2</property>
<property name="c3p0.timeout">5000</property>
<property name="c3p0.max_statements">100</property>
<property name="c3p0.idle_test_period">3000</property>
<property name="c3p0.acquire_increment">2</property>
<property name="c3p0.validate">false</property>
<!--显示Hibernate自动生成的SQL-->
<property name="show_sql">true</property>
<property name="current_session_context_class">thread</property>
<!--映射文件的注册-->
<mapping resource="hbm/User.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Hibernate配置文件hibernate.cfg.xml
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 在开发过程中,hibernate的配置是较为复杂的一部分。首先,就是hibernate.cfg.xml文件的配置,...
- Hibernate.cfg.xml配置文件结构详解 Hibernate中配置主要分为两种:一种包含了Hiberna...
- Spring MVC中,applicationContext.xml [ServletName]-servlet....
- 要求 位置:放到src下 名称:必须是hibernate.cfg.xml 配置三部分 配置数据库信息(必须的) 配...