亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

我想問下可以實現 別名映射 一個集合屬性怎么寫呢

我想問下可以實現 別名映射 一個集合屬性怎么寫呢

正在回答

1 回答

比如要 有一個類是Items類,里面有一個 List<Detail> detailList屬性,映射可以使用 resultMap標簽,

<resultMap id="ItemsMap" type="com.xxxx.Items">

? ? ? ? <id column="xx" property="xx" /> <!-- 普通字段的映射 -->

?????? <result column="xxx" property="xxx" />

? ? ? ? ? ?..........................................

? ? ? ?<collection property="detailList" ofType="com.xxx.Detail"> <!-- 集合字段的映射 -->

?????????? <id column="detail_id" property="id" />

?????????? <result column="items_id" property="itemsId" />

?????????? <result column="items_num" property="itemsNum" />

?????? </collection>

</resultMap>。

在你的select中引用這個resultMap

<select id = "selectItems" resultMap="ItemsMap">

......

如果說錯了,請指正

1 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

我想問下可以實現 別名映射 一個集合屬性怎么寫呢

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號