hibernate 使用hibernate 的注解做多对一双向映射

**

 * 班级

 * @author Administrator

 * @hibernate.class table="t_grade"

 *

 */

public class Grade {

 

/**

* @hibernate.id generator-class="native"

*/

private int id;

 

/**

* 名称

* @hibernate.property

*/

private String name;

 

/**

* 包含的学生

* @hibernate.set inverse="true" lazy="extra"

* @hibernate.key column="gradeId"

* @hibernate.one-to-many class="com.eomist.model.Student"

*/

private Set student;

 

/**

* @hibernate.many-to-one

*/

private Teacher teacher;

 

}

 

 

 

public void Student{

 

/**

* @hibernate.many-to-one

*/

private Grade grade;

 

}

 

你可能感兴趣的:(hibernate 使用hibernate 的注解做多对一双向映射)