Hibernate鏈接池C3PO配置

1 =================== C3P0 配置 =============================
Xml代碼

    <?xml version="1.0" encoding="UTF-8"?> 
    <!DOCTYPE hibernate-configuration PUBLIC  
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"  
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 
    <hibernate-configuration> 
        <session-factory> 
        <!-- 配置事務實現方式 -->    Spring配置中transactionAttributes的使用方法和做用          <property name="transaction.factory_class">             org.hibernate.transaction.JDBCTransactionFactory                                         </property>                    <!-- 配置JDBC裏batch的大小 -->            <property name="jdbc.batch_size">50</property>            <property name="cache.use_second_level_cache">false</property>                    <!-- 配置線程安全的session -->           <property name="current_session_context_class">thread</property>                      <!-- 顯示SQL -->            <property name="show_sql">true</property>            <property name="format_sql">true</property>                        <!-- 配置數據庫方言 -->            <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>                        <!-- 配置數據庫鏈接 -->            <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>            <property name="connection.username">0804</property>            <property name="connection.password">0804</property>            <property name="connection.url">jdbc:oracle:thin:@192.168.0.200:1521:orcl</property>                       <!-- 配置鏈接池 -->            <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管理的映射文件 -->            <mapping resource="com/ket/ruan/so/entity/User.hbm.xml"/>              <mapping resource="com/ket/ruan/so/entity/Product.hbm.xml"/>              。。。。。           </session-factory>      </hibernate-configuration> 
相關文章
相關標籤/搜索