| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1119 人关注过本帖
标题:spring2.5+hibernate3.6+struts2.2哪位大侠能把忙找找错误??不胜感激
取消只看楼主 加入收藏
huang1003
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-12-16
收藏
 问题点数:0 回复次数:0 
spring2.5+hibernate3.6+struts2.2哪位大侠能把忙找找错误??不胜感激
spring配置文件:
        <property name="annotatedClasses">
            <list>
                <value>com.pmmp.model.Blog</value>
                <value>com.pmmp.
            </list>
        </property>

Blog类代码:
@Entity
public class Blog {
    private int id;                //博文的唯一标记
    private List<Comment> commentList;    //评论列表

    @Id
    @GeneratedValue
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    @OneToMany(mappedBy="blog")
    public List<Comment> getCommentList() {
        return commentList;
    }
    public void setCommentList(List<Comment> commentList) {
         = commentList;
    }
}
Comment类的代码:
public class Comment {
    private int id;                //评论的唯一标记
    private Blog blog;            //评论所属的博文

    @Id
    @GeneratedValue
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }

    @ManyToOne
    @JoinColumn(name="blog_id")
    public Blog getBlog() {
        return blog;
    }
    public void setBlog(Blog blog) {
        this.blog = blog;
    }
}

错误提示:
Caused by: org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: com.pmmp.model.[com.pmmp.]
    at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:1168)
    at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:693)
    at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:628)
    at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:65)
    at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1686)
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1393)
    at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1345)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:673)
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
    ... 52 more


[ 本帖最后由 huang1003 于 2011-7-25 13:19 编辑 ]
搜索更多相关主题的帖子: spring 配置文件 private 不胜感激 property 
2011-07-25 13:17
快速回复:spring2.5+hibernate3.6+struts2.2哪位大侠能把忙找找错误??不胜感激 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017164 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved