hi all,
I am confused about how to configure c3p0 connection pool of hibernate in Spring.
In my application, I configure database source as following:
I am configuring sessionFactory as following:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/testdb?useCursorFetch=true&useServerPrepStmts=true"/> <property name="username" value="root"/> <property name="password" value=""/> </bean>
<!-- Hibernate SessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"><ref local="dataSource"/></property> <property name="mappingResources"> <list> <!-- Write here your list of Hibernate files --> <value>hibernate/catalogue/Article.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.c3p0.minPoolSize">${hibernate.c3p0.minPoolSize}</prop> <prop key="hibernate.c3p0.maxPoolSize">${hibernate.c3p0.maxPoolSize}</prop> <prop key="hibernate.c3p0.timeout">${hibernate.c3p0.timeout}</prop> <prop key="hibernate.c3p0.max_statement">${hibernate.c3p0.max_statement}</prop> <prop key="hibernate.generate_statistics">true</prop> <prop key="hibernate.cache.use_query_cache">true</prop> </props> </property> </bean>
As you seen, I use a jdbc connection dataSource to sessionFactory and configure c3p0 related hibernate property in sessionFactory. My first question is, if I am using c3p0 already?
In addition, I want to know if hibernate's own connection pool is based on c3p0? If yes, any performance difference bw my configuration and using a c3p0 connecton pool datasource?
|