我很少运气配置我的Spring配置文件用于Hibernate Annotations。我一直在看其他帖子,我不确定我错过了什么。我不需要定义配置文件,因为我在会话工厂中使用HibernateProperties正确吗?我收到以下错误:
无法实例化bean类[org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]:构造函数抛出异常;嵌套异常是java.lang.NoClassDefFoundError:org.hibernate.cfg.AnnotationConfiguration
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
<!-- Defines the hibernate session factory to be used by the hibernate support dao classes -->
<bean id="HibernateSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" >
<property name="dataSource" ref="webDataSrc" />
<property name="annotatedClasses">
<list>
<value>ca.test.Foo</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="debug">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">false</prop>
</props>
</property>
</bean>
答案 0 :(得分:0)
你的类路径上有Hibernate Annotations
jar吗?