1.映射對應的屬性,區分他們分別屬於哪些類。(sql書寫的時候爲何要將前綴加上(別名),是由於便於它去尋找哪一個類的前綴是ANNEX_)sql
2.例: 以下所示當一個collection 定義了一個columnPrefix時,其含義是將ANNEX_前綴自動添加到它下面的column中,爲其彌上須要的前綴,(ANNEX_ID,ANNEX_ANNEX,ANNEX_ANNEXNAM)spa
___________________________________________________________________________________________________________get
<collection property="brandnoticeannexes" ofType="com.hyphone.brand.entity.BrandNoticeAnnex" columnPrefix="ANNEX_">
<id property="id" column="ID"/> (ANNEX_ID)
<result property="annex" column="ANNEX"/> (ANNEX_ANNEX)
<result property="annexname" column="ANNEXNAME"/> (ANNEX_ANNEXNAME)
</collection>it
<select id="getLocalNoticeById" resultMap="brandnoticeannexes">
SELECT
NA.ID ANNEX_ID,
NA.ANNEX ANNEX_ANNEX,
NA.ANNEXNAME ANNEX_ANNEXNAME
FROM U_USER
</select >io
___________________________________________________________________________________________________________