ibatis sqlmap
ibatis一对多配置注:返回一个类对象时sql语句中
SELECTT.REPLY_IDreplyId,T.MESSAGE_IDmessageId,T.REPLY_CONTENTreplyContentFROMB2B_REPLYT
如果字段名称与实体bean中的不对应则在sql中应指定对应的bean名称否则查询结果为null
<resultMapid="result1"class="message"extends="MessageInfo">
<resultproperty="replys"column="MESSAGE_ID"select="B2B_MASSAGE.getReplyByMsgId"/>
</resultMap>
<selectid="getMessageById"parameterclass="java.lang.Long"resultMap="result1">
<![CDATA[
SELECT
BM.MESSAGE_ID,BM.TITLE,BM.CONTENT,BM.FKMES_ID,BM.FKMES_NAME,BM.TAG,BM.MESSAGE_TIME,
BM.URL,BM.FLAG,BM.LUID,BM.LUNAME,BM.SHOPID
FROMB2B_MASSAGEBMWHEREBM.FKMES_ID=#fkmesId#ORDERBYBM.MESSAGE_TIMEDESC
]]>
</select>
<selectid="getReplyByMsgId"parameterclass="java.lang.Integer"resultclass="reply">
<![CDATA[
SELECTT.REPLY_IDreplyId,T.MESSAGE_IDmessageId,T.REPLY_CONTENTreplyContentFROMB2B_REPLYTWHERET.MESSAGE_ID=#fkmesId#
]]>
</select>