Hibernate Annotation的一个错误

本文记录了一次Spring框架中出现的依赖注入失败问题及其解决过程。问题出现在文档控制系统中,涉及DocumentServiceImpl、DocumentContr及DocumentDAO等组件之间的依赖关系。最终发现是由于MeetingDocument实体类中的关联映射配置错误导致Hibernate无法识别关联的Meeting实体类。
2013-02-26 23:09:02.285::WARN:  Failed startup of context org.mortbay.jetty.webapp.WebAppContext@1f9b804{/smartmeeting,D:\workspace\smartmeeting\src\main\webapp}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentContr': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wushi.smartmeeting.service.DocumentServiceImpl com.wushi.smartmeeting.controller.DocumentContr.documentService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'docService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wushi.smartmeeting.dao.DocumentDAO com.wushi.smartmeeting.service.DocumentServiceImpl.docDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.wushi.smartmeeting.dao.DocumentDAO.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.wushi.smartmeeting.model.MeetingDocument.meeting references an unknown entity: com.wushi.smartmeeting.model.Meeting
    at org.springframe


==================

解决办法:

在Meeting class 中增加 @Entity
                       @Table("MEETING")
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值