我尝试遵循一个关于 Spring IDE with Hibernate 的教程。我正在使用 spring 框架 3.2,我创建了自己的库,其中包含所有 jar 框架,我还有另一个库 hibernate 4 我做了同样的例子,但我仍然有这个消息:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
<bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="org.postgresql.Driver"/>
<property name="url" value="jdbc:postgresql:T"/>
<property name="username" value="postgres"/>
<property name="password" value="root"/>
</bean>
<bean id="SessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="datasource" ref="datasource"/>**No setter found for property 'datasource' in class
'org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean'**
<property name="annotatedClasses">
<list>
<value>com.model.Cours</value>
<value>com.model.Student</value>
</list>
</property>
</bean>
</beans>
告诉我为什么?如果可能存在 annotation.AnnotationSessionFactoryBean 的问题,请提出建议。我使用 hibernate4 并且它不存在 hibernate4.annotation ...