What error are you getting? Did you try updating your query to reference a.id and b.id by aliases? This should work.
select a.id as id1, b.id as id2, b.company
from prod a, prod_loc b
where a.id = b.company
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"/>
</resultMap>
The following short-hand notation DOES work. But I need
to use ResultMap to handle some primitive types and null
values.
- Paul