//表major的映射文件
<hibernate-mapping>
<class name= "com.crownsoft.qsm.bean.Major " table= "major ">
<id name= "id " type= "java.lang.String ">
<column name= "id " length= "2 " />
<generator class= "increment " />
</id>
<property name= "name " type= "java.lang.String ">
<column name= "name " length= "20 " not-null= "true " />
</property>
<property name= "shortname " type= "java.lang.String ">
<column name= "shortname " length= "10 " not-null= "true " />
</property>
<property name= "department " type= "java.lang.String ">
<column name= "department " length= "4 " not-null= "true " />
</property>
<set name= "classes " inverse= "true " cascade= "all ">
<key>
<column name= "majorid " length= "2 " not-null= "true " />
</key>
<one-to-many class= "com.crownsoft.qsm.bean.Classes " />
</set>
</class>
</hibernate-mapping>
//表classes的映射文件
<hibernate-mapping>
<class name= "com.crownsoft.qsm.bean.Classes " table= "classes ">
<id name= "id " type= "java.lang.Integer ">
<column name= "id " />
<generator class= "increment " />
</id>