1、多对一关联
eg:<many-to-one name="district" class="cn.jbit.houserent.bean.District" column="district id not-null="true"/>
属性
name
class
column
not-null
lazy
fetch
2、一对多关联
eg:
<set name="streets" table="street">
<!-- 设置关联的字段
<key>
</key>
<!--设置关联的对象-->
<one-to-many class="cn.jbit.houserent.bean.Street"/>
</set>
属性
name
table
lazy
fetch
3、多对多关联
eg:<!--
<class name="Project" table="project">
</class>
<!--
<class name="Employee" table="employee">
</class>
set节点中table属性值为关联表的表名,其下key子节点的column属性为关联表中关联到自己的字段名,
many-to-many中,class用来设置关联属性的类型,column属性用来设定用哪个字段外键去关联