部署代碼如下:
<!-- 映射Map 集合屬性 -->
<map name="score" table="scores_inf" lazy="true">
<key column="preson_id"></key>
<map-key type="string" column="subject"></map-key>
<element column="score" type="float"></element>
</map>
說明:
使用 lazy = "true" 能保證在加載的時候不是馬上加載,當真正要用的時候才加載,這樣如果 Map 或者是集合比較大的時候提高效率。
下面是生成的表的結構,主鍵 顯然是由 person_id 和 subject 也就是 聯合而成