ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Glezen <pgle...@us.ibm.com>
Subject Join 2 tables with same column name
Date Tue, 16 Aug 2005 23:46:09 GMT

Hi Folks,

I'm struggling with a query like the following.

select a.id, b.id, b.company
  from prod a, prod_loc b
 where a.id = b.company

I want to map the three attributes to a Product
object as follows:

  product.id      --> a.id
  product.locId   --> b.id
  product.company --> b.company

When I define the ResultMap, the column attribute of the
result tag doens't seem to accept the table qualifier I
used in the select statement.

 <resultMap id="getProductResult" class="my.Product">
    <result property="id"      column="a.id"/>
    <result property="locId"   column="b.id"/>
    <result property="company" column="b.company"/>

The following short-hand notation DOES work.  But I need
to use ResultMap to handle some primitive types and null

- Paul
View raw message