hibernate框架學習之核心配置文件
阿新 • • 發佈:2018-07-22
encoding driver user pool prope jdbc nat false form
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.Driver
connection.url=jdbc:mysql://localhost:3306/h3
hibernate框架學習之核心配置文件