hibernate.cfg.xml
<?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://localhost:3306/h3</property> ???????<property name="connection.username">root</property> ???????<property name="connection.password">root</property> ???????<!-- 配置连接池数量 ????????<property name="connection.pool_size">5</property>--> ???????<!-- c3p0连接池使用 --> ???????<property name="hibernate.c3p0.min_size">10</property> ???????<property name="hibernate.c3p0.max_size">1000</property> ???????<property name="hibernate.c3p0.timeout">181</property> ???????<!-- 可选配置 --> ???????????????<!-- 方言配置 --> ???????<property name="dialect">org.hibernate.dialect.MySQLDialect</property> ???????<!-- 控制是否显示执行的SQL语句 --> ???????<property name="show_sql">true</property> ???????<!-- 格式化SQL语句 --> ???????<property name="format_sql">false</property> ???????????????<!-- 自动生成表结构 ????????<property name="hbm2ddl.auto">create</property>--> ???????????????<!-- 自动提交事务 --> ????????<property name="connection.autocommit">true</property> ???????<!-- 资源注册 --> ???????<mapping resource="cn/itcast/h3/helloworld/vo/UserModel.hbm.xml"/> ???????????</session-factory></hibernate-configuration>
hibernate.properties
connection.driver_class=com.mysql.jdbc.Driverconnection.url=jdbc:mysql://localhost:3306/h3
hibernate框架学习之核心配置文件
原文地址:https://www.cnblogs.com/xyhero/p/9348886.html