在hibernate利用生成数据库时,出现异常 15

org.hibernate.MappingException:Couldnotdeterminetypefor:com.forum.model.User,attable:... org.hibernate.MappingException: Could not determine type for: com.forum.model.User, at table: Message, for columns: [org.hibernate.mapping.Column(user1)]
User类
@Entity
public class User {
//下面是User的属性
//主要是id,姓名,邮箱地址,登录密码,自身的帖子
private int id;
private String name;
private String password;
private String mail;

@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}

public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}

}
@Entity
@IdClass(MessagePK.class)
public class Message {
private User user1;
private User user2;
private Date date;
private String content;
private boolean received;

@Id
@Column(name="u1")
public User getUser1() {
return user1;
}
public void setUser1(User user1) {
this.user1 = user1;
}
@Id
@Column(name="u2")
public User getUser2() {
return user2;
}
public void setUser2(User user2) {
this.user2 = user2;
}
@Id
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}

public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public boolean isReceived() {
return received;
}
public void setReceived(boolean received) {
this.received = received;
}

}
展开
 我来答
f2316056859
2014-09-22 · TA获得超过121个赞
知道小有建树答主
回答量:124
采纳率:100%
帮助的人:60.4万
展开全部
应该是你的hibernate映射文件有错,在映射Message实体类的user1字段时报错。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式