Hibernate many-to-one relation mapping:
public class Student{
.....
private CoreClass class;
public CoreClass getter....
public void setter
}
public class CoreClass{
....
}
<many-to-one name="class" column="classId" class="CoreClass" not-null="" cascade=""/>
Note
1. for the attribute not-null, if set to 'true', before insert data to database, hibernate will check, if class is null, throw exception before insert data
2. cascasde: mostly, the value should be 'save-update', should not be any value related to 'delete'
3. the order of insert one instance of class to database( class has already been assigned with vlaue) 3.1 insert class instance to db(if there is any mapping setting for CoreClass, it will done first) 3.2 insert student instance to db