簡體   English   中英

嘗試使用Spring WebFlow在Hibernate中配置c3p0池

[英]trying to Configur c3p0 pooling in Hibernate using Spring WebFlow

我正在使用Spring在Hibernate中配置內置的c3p0池,但是它給我帶來了錯誤,它不喜歡任何C3P0之類的東西:

<prop name="hibernate.c3p0.min_size" value="2" />
<prop name="hibernate.c3p0.max_size" value="5" />

有人可以告訴我為什么嗎?

<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
    <!--suppress InjectionValueTypeInspection -->
    <property name="mappingResources" ref="hibernateMappingList" />
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">net.sf.hibernate.dialect.Oracle9Dialect</prop>
            <prop key="transaction.factory_class">
                net.sf.hibernate.transaction.JDBCTransactionFactory
            </prop>
            <prop key="hibernate.transaction.factory_class">
                net.sf.hibernate.transaction.JDBCTransactionFactory
            </prop>
            <prop key="hibernate.show_sql">false</prop>
            <prop key="hibernate.cglib.use_reflection_optimizer">false</prop>
            <prop key="hibernate.jdbc.batch_size">0</prop>

            <prop name="hibernate.c3p0.min_size" value="2" />
            <prop name="hibernate.c3p0.max_size" value="5" />
            <prop name="hibernate.c3p0.timeout" value="600" />
            <prop name="hibernate.c3p0.max_statements" value="0" />
            <prop name="hibernate.c3p0.idle_test_period" value="300"/>
            <prop name="hibernate.c3p0.acquire_increment" value="1" />
      </props>
    </property>
</bean>

這是我的數據庫源信息:

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
        destroy-method="close">

        <!-- these are C3P0 properties -->
        <property name="acquireIncrement" value="${database.acquireIncrement}" />
        <property name="minPoolSize" value="${database.minPoolSize}" />
        <property name="maxPoolSize" value="${database.maxPoolSize}" /> 
        <property name="maxIdleTime" value="${database.maxIdleTime}" />

        <property name="driverClass" value="${database.driver}" />
        <property name="jdbcUrl" value="${database.url}" />
        <property name="user" value="${database.user}" />
        <property name="password" value="${database.password}" />
    </bean>

XML錯誤。 在以下部分

       <prop name="hibernate.c3p0.min_size" value="2" />
       <prop name="hibernate.c3p0.max_size" value="5" />
       <prop name="hibernate.c3p0.timeout" value="600" />
       <prop name="hibernate.c3p0.max_statements" value="0" />
       <prop name="hibernate.c3p0.idle_test_period" value="300"/>
       <prop name="hibernate.c3p0.acquire_increment" value="1" />

使用與其他屬性相同的格式替換它

       <prop key="key">value</prop>

prop元素使用與property元素不同的屬性。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM