Hi All,

I am wondering how we can resolve the following naming issues.
Suppose we have two objects TestPlan and Release, both of them have a field
named id. If we want to reuse the resultMap, what should we do when we
create a query against these tables since both tables have the field id, is
there any way in iBatis to identify which field should be mapped to which
object?

Thanks in advance,
-Peng

<resultMap id="testPlanResult" class="TestPlan" groupBy="id">
   <result property="id" column="id"/>
   <result property="version" column="version"/>
   <result property="name" column="name"/>
   <result property="createdDate" column="createdDate" javaType="
java.util.Date" />
   <result property="release" resultMap="Release.releaseResult"/>
</resultMap>

<resultMap id="releaseResult" class="Release" >
   <result property="id" column="id"/>
   <result property="version" column="version"/>
   <result property="name" column="name"/>
</resultMap>


<select id="findTestPlans" resultMap="testPlanResult">
   select
    tp.id as id,
    tp.version as version,
    tp.name as name,
    tp.createdDate as createdDate,
    r.id as ?????
   from TestPlan tp left join release r on tp.release = r.name
 </select>

Reply via email to