[英]Spring 3 with Hibernate 3 Annotations - Session Factory Configuration
I am having very little luck configuring my spring config file for Hibernate Annotations.我在为 Hibernate 注释配置 spring 配置文件时运气不佳。 I have been looking at other posts and I'm not sure what I am missing.
我一直在看其他帖子,但我不确定我错过了什么。 I shouldn't need to define a config file since I am using HibernateProperties in my session factory correct?
我不需要定义配置文件,因为我在 session 工厂中使用 HibernateProperties 对吗? I`m getting the following error:
我收到以下错误:
Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception;无法实例化 bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]:构造函数抛出异常; nested exception is java.lang.NoClassDefFoundError: org.hibernate.cfg.AnnotationConfiguration
嵌套异常是 java.lang.NoClassDefFoundError: org.hibernate.cfg.AnnotationConfiguration
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)在 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>
Is Hibernate Annotations
jar on your classpath? Hibernate Annotations
jar 在您的类路径上吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.