ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maarten Bosteels" <mbosteels....@gmail.com>
Subject duplicate column names
Date Tue, 10 Oct 2006 19:37:17 GMT
Hello,

I found this example in the Developer Guide::

<resultMap id="get-product-result" class="com.ibatis.example.Product">
<result property="id" column="PRD_ID"/>
<result property="description" column="PRD_DESCRIPTION"/>
<result property="category" resultMap="get-category-result" />
</resultMap>

<resultMap id="get-category-result" class="com.ibatis.example.Category">
<result property="id" column="CAT_ID" />
<result property="description" column="CAT_DESCRIPTION" />
</resultMap>

<select id="getProduct" parameterClass="int" resultMap="get-product-result">
select *
from PRODUCT, CATEGORY
where PRD_CAT_ID=CAT_ID
and PRD_ID = #value#
</select>

What if the columns in PRODUCT and CATEGORY do not have the PRD_ and CAT_
prefixes and share column-names (eg ID) ?
It would most probably work to have a column alias for every column
but I would like to avoid that and stick with the star in "select *
from"

I am having a similar problem with RowMapper and Spring's JDBCTemplate
and wondered if iBatis has a solution.

Thanks, I hope my question is clear.

Maarten

Mime
View raw message