Hibernate学习笔记—hibernate.cfg.xml剖析
2017-09-04 09:19
274 查看
一、数据库连接配置(必须配置)
<!-- 数据库驱动 --> <property name="connection.driver_class">org.hsqldb.jdbcDriver</property> <!-- 数据库url --> <property name="connection.url">jdbc:hsqldb:hsql://localhost</property> <!-- 用户名 --> <property name="connection.username">root</property> <!-- 用户密码 --> <property name="connection.password">root</property>
二、注册映射文件配置(必须配置)
<!-- 注册映射文件,包名用斜线分割 --> <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/>
三、可选配置
<!-- Hibernate默认使用数据库的连接池进行连接,此处为连接池的连接数量 --> <property name="connection.pool_size">1</property> <!-- 数据库的方言,不同数据库的SQL语言会有差别,hibernate可以根据不同的数据库来生成不同的sql,每一种数据库hibernate为我们定义了一种方言 --> <property name="dialect">org.hibernate.dialect.HSQLDialect</property> <!-- 是否输出SQL语句 --> <property name="show_sql">true</property>
四、第三方数据库连接池配置
<!-- 数据库连接最小连接数,使用第三方的c3p0 --> <property name="c3p0.min_size">10</property> <!-- 数据库连接最大连接数,使用第三方的c3p0 --> <property name="c3p0.max_size">20</property> <!-- 连接数据库的超时时间(单位为毫秒),使用第三方的c3p0 --> <property name="c3p0.timeout">3000</property>
相关文章推荐
- hibernate学习笔记(一)---------hibernate.cfg.xml文件的具体配置
- hibernate.cfg.xml中Oracle 11g的dialect配置
- 5.Hibernate首例:hibernate.cfg.xml
- Hibernate学习之hibernate.cfg.xml配置
- 【hibernate.cfg.xml】的配置说明
- hibernate.cfg.xml配置总结
- 无需hibernate.cfg.xml的spring配置
- hibernate学习:hibernate.cfg.xml文件中与数据库的两种连接
- 5.1 Hibernate配置文件(hibernate.cfg.xml)
- hibernate.cfg.xml配置文件分析
- maven hibernate hibernate.cfg.xml以及 XXX.hbm.xml文件找不到
- hibernate.cfg.xml
- hibernate.cfg.xml文件的说明
- Hibernate学习之hibernate.cfg.xml
- hibernate.cfg.xml
- 关于hibernate.properties和hibernate.cfg.xml的分析
- hibernate.cfg.xml配置
- hibernate.cfg.xml的参数详解
- Hibernate 如果 hibernate.cfg.xml 没有放在 src 下,则使用以下配置方式
- hibernate.cfg.xml中配置详解