日期:2014-05-17  浏览次数:20554 次

hibernate映射问题??
求大神解决!!
错误:
Exception in thread "main" org.hibernate.MappingException: Unknown entity: com.hibernate.model.Student

Student.hbm.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.hibernate.model">

<class name="com.hibernate.model.Student" table="student">
<id name="id" column="s_id" type="integer">
<generator class="native" />
</id>
<property name="name" column="s_name" type="string"></property>
<property name="sex" column="s_sex" type="string"></property>
<property name="age" column="s_age" type="integer"></property>
<property name="time" column="s_time" type="date"></property>

</class>
</hibernate-mapping>


Student.java:

package com.hibernate.model;

import java.util.Date;

public class Student {
private int id;
private String name;
private String sex;
private int age;
private Date time;

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 getSex() {
return sex;
}

public void setSex(String sex) {
this.sex = sex;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public Date getTime() {
return time;
}

public void setTime(Date time) {
this.time = time;
}
}