Created
July 23, 2012 10:14
-
-
Save pengju/3162953 to your computer and use it in GitHub Desktop.
hibernate的配置文件(主要设置项)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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:///db_shop</property> | |
<property name="connection.username">root</property> | |
<property name="connection.password">root</property> | |
<!-- 配置Hibernate方言 --> | |
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> | |
<!-- 配置Hibernate连接池 --> | |
<property name="hibernate.c3p0.max_size">2</property> | |
<property name="hibernate.c3p0.min_size">2</property> | |
<property name="hibernate.c3p0.timeout">5000</property> | |
<property name="hibernate.c3p0.max_statements">100</property> | |
<property name="hibernate.c3p0.idle_test_period">3000</property> | |
<property name="hibernate.c3p0.acquire_increment">2</property> | |
<property name="hibernate.c3p0.validate">false</property> | |
<!-- 在控制台打印生成的SQL语句 --> | |
<property name="hibernate.show_sql">true</property> | |
<!-- 将Session绑定在线程上 --> | |
<property name="current_session_context_class">thread</property> | |
<!-- 注册映射文件 --> | |
<mapping resource="com/kaishengit/pojo/User.hbm.xml"/> | |
<mapping resource="com/kaishengit/pojo/Address.hbm.xml"/> | |
<mapping resource="com/kaishengit/pojo/Card.hbm.xml"/> | |
<mapping resource="com/kaishengit/pojo/Card2.hbm.xml"/> | |
<mapping resource="com/kaishengit/pojo/Teacher.hbm.xml"/> | |
<mapping resource="com/kaishengit/pojo/Student.hbm.xml"/> | |
</session-factory> | |
</hibernate-configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment