PDA

View Full Version : Help: TypeMismatchException


java9394
Aug 26th, 2004, 01:00 PM
I am new to SpringFramework. I tried to use c3p0 connection pool with my code. I can use the XmlBeanFactory to get the ComboPooledDataSource. However, I got TypeMismatchException when I tried to get productManager instance.

Failed to convert property value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource']

Any idea?

Thanks.

java9394


<beans>
<bean id="productDS" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass"><value>oracle.jdbc.OracleDriver</value></property>
<property name="jdbcUrl"><value>jdbc:oracle:thin:correctURLforDB</value></property>
<property name="minPoolSize"><value>1</value></property>
<property name="acquireIncrement"><value>1</value></property>
<property name="maxPoolSize"><value>10</value></property>
</bean>
<bean id="productManager" class="com.mycom.ProductManagerDaoJdbc">
<property name="dataSource"><idref local="productDS"/></property>
</bean>
</beans>

irbouho
Aug 26th, 2004, 01:58 PM
productManager definition should be

<bean id="productManager" class="com.mycom.ProductManagerDaoJdbc">
<property name="dataSource"><ref local="productDS"/></property>
</bean>

java9394
Aug 26th, 2004, 02:45 PM
Thanks. It worked. So the idref is short hand and error-proof for <value/> only then :)