2012-09-06 86 views
0

我配置试图Configur c3p0池在Hibernate中内置c3p0池在使用Hibernate的春天,但它给我的错误是不喜欢任何的C3P0东西,如:使用Spring的Webflow

<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> 
+0

什么错误?你能发布有关错误的细节吗? –

+0

春天不喜欢“prop name =” –

+0

你可以粘贴你的数据源配置吗?此外,我看到你使用所有你的cpo配置。你有没有尝试类似于 2

回答

1

的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元件不同的属性替换它。

+0

我尝试过,我改变了大小来测试,它没有工作...我做了min_size为10,仍然从数据源得到最小值 –

+0

每个问题的一个答案:)。如果您已经修复了原始问题,请将此答案标记为正确答案并提出另一个问题。 – Augusto

+0

我没有另一个 –