ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shepherdz <zhaoxin...@ndtech.com.cn>
Subject Re: When returning mutiple objects and transforming "directly to xml
Date Tue, 06 Jun 2006 01:19:17 GMT

RowHandler will be OK in mapping results with no nested structure. But I'm
afraid that it cannot handle result with nested structure. Look the
following mapping I used for testing:

<sqlMap namespace="TEST">
  <resultMap id="Master" class="java.util.HashMap" groupBy="id">
    <result property="id" column="MasterID" />
    <result property="name" column="MasterName" />
    <result property="details" javaType="java.util.ArrayList"
resultMap="TEST.Detail" />
  <resultMap id="Detail" class="java.util.HashMap" groupBy="id">
    <result property="id" column="DetailID"/>
    <result property="name" column="DetailName"/>
    <result property="anothers" javaType="java.util.ArrayList"
  <resultMap id="Another" class="java.util.HashMap">
    <result property="id" column="AnotherID"/>
    <result property="name" column="AnotherName"/>
  <select id="showMaster" parameterClass="java.lang.String"
    SELECT M.M_ID as MasterID, M.M_Name as MasterName,
    D.D_ID as DetailID, D.D_Name as DetailName,
    A.A_ID as AnotherID, A.A_Name as AnotherName
    FROM MasterTable M
    LEFT OUTER JOIN DetailTable D ON D.MasterTable = M.M_ID
    LEFT OUTER JOIN AnotherTable A ON A.DetailTable = D.D_ID
    WHERE M.M_ID = #value#

How does RowHandler handle this?
View this message in context: http://www.nabble.com/When-returning-mutiple-objects-and-transforming-%22directly-to-xml-t1718587.html#a4725268
Sent from the iBATIS - User - Java forum at Nabble.com.

View raw message