I had a much more detailed post written up about this with more code samples and all, but this posting system is not letting me post it because it is detecting non-existent "URLs to other sites" in it. So here's a short version. Will get to the longer one soon:
Summary: Cannot inject JdbcTemplate into any JDBC-backed (JdbcDaoSupport) DAOs if we use the new aop config/tx advice declarative way of managing transactions. We have a mix of HibernateDaoSupport and JdbcDaoSupport DAOs and want to make our service layer which calls this transactional. Our transaction manager is a HibernateTransactionManager. As soon as we wire in the aop pointcut for service methods and a tx advice to go with it (cannot post code yet because the system won't let me), we run into:
Error:
Annotation-based transactions work fine.Code:org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy57 implementing org.springframework.jdbc.core.JdbcOperations,org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.springframework.jdbc.core.JdbcTemplate] for property 'jdbcTemplate'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy57 implementing org.springframework.jdbc.core.JdbcOperations,org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.springframework.jdbc.core.JdbcTemplate] for property 'jdbcTemplate': no matching editors or conversion strategy found at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1288) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1249) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) ... 131 more
Any pointers appreciated. Will get to the more detailed post soon.
Much obliged,
Uqbar


Reply With Quote

