通过one-to-many建立classes类与student类的关联

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.tfy.heibernate.mangtoone.Classes" table="classes2">
<id name="cid" type="java.lang.Long">
<generator class="increment"></generator>
</id>
<property name="cname" type="java.lang.String"></property>
<property name="description" type="java.lang.String"></property>
<set name="students" cascade="all" inverse="true">
<!--
key是用来描述外键
帮助hibernate生成sql语句的
-->
<key>
<column name="cid"></column>


</key>
<!--
通过one-to-many建立classes类与student类的关联
-->
<one-to-many class="com.tfy.heibernate.mangtoone.Student" />

</set>
</class>
</hibernate-mapping>

你可能感兴趣的:(one-to-many)