=================================================================================
spa
模板:it
<!-- ?屬性,本類與?類的多對多的關係 -->table
<set name="第一個問號值" table="中間表(類名_對方類名 或 對方類名_類名)其中兩個地方的要同樣">
<key column=" (本類的名字+Id) "></key>
<many-to-many class="第二個問號值" column="(對方的key裏面的column屬性的值)"></many-to-many>
</set>
<!-- ?屬性,本類與?類的多對一的關係 -->
<many-to-one name="(第一個問號的值)" class="(第二個問號的值)" column="(name的屬性名 + Id)"></many-to-one>
<!-- ?屬性,本類與?類的一對多 -->
<set name="(第一個問號的值)">
<key column="(與其關聯(多對一中)的類的column的值) "></key>
<one-to-many class="(第二個問號的值)" />
</set>ast
==================================================================================模板
-------------------------------------------------------------------------------------------------------------------class
eg:tab
-------------------------------------------------------------------------------------------------
<!-- department屬性,本類與Department的多對一 -->
<many-to-one name="department" class="Department" column="departmentId"></many-to-one>
<!-- roles屬性,本類與Role的多對多 -->
<set name="roles" table="itcast_user_role">
<key column="userId"></key>
<many-to-many class="Role" column="roleId"></many-to-many>
</set>
<!-- users屬性,本類與User的一對多 -->
<set name="users">
<key column="departmentId"></key>
<one-to-many class="User" />
</set>
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
<!-- parent屬性,本類與Department(上級)的多對一 -->
<many-to-one name="parent" class="Department" column="parentId"></many-to-one>co
<!-- children屬性,本類與Department(下級)的一對多 -->
<set name="children">
<key column="parentId"></key>
<one-to-many class="Department" />
</set>
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
<!-- users屬性,本類與User的多對多 -->
<set name="users" table="itcast_user_role">
<key column="roleId"></key>
<many-to-many class="User" column="userId"></many-to-many>
</set>
------------------------------------------------------------------------
------------------------------------------------------------------------cas