You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "Eric T. Blue" <er...@gmail.com> on 2006/03/30 00:47:18 UTC

Re: A couple of questions

Tony,

Try aliasing the duplicate columns.  For example:

Select a.column1 as a_column1, b.column1 as b_column1 from table1 a, table2
b
where b.some_id = a.id

On 3/29/06, Tony Qian <da...@aol.com> wrote:
>
> All,
>
> Got two questions on iBATIS DAO.
>
> 1) I have two tables.  Those two tables happen to have a column with same
> name.  I try to join those two table first and then use groupBy to construct
> two lists, one for each table. The problem is that I cannot use table
> qualifier to specify the data from a particular table, such as
> C.expiration_date and S.expiration_date.
>
> <resultMap id="savingCardMap" class="MemberSavingCard"
> groupBy="savingCardId">
>           <result property="savingCardId" column="saving_card_id" />
>           <result property="expirationDate" column="S.expiration_date"
> />    // expiration_date from saving_card table
>   </resultMap>
>
>   <resultMap id="couponToInforteMap" class="Coupon" groupBy="couponId">
>           <result property="couponId" column="coupon_id" />
>           <result property="expirationDate" column="C.expiration_date" />
> // expiration_date from coupon table
>   </resultMap>
>
> select
>          C.coupon_id,
>          C.expiration_date,
>          S.saving_card_id,
>          S.expiration_date
> from coupon as C, saving_card as S where ....
>
> 2) if we use SqlMapClient, we can do batch transaction. Does DaoManager
> support batch transaction similar to SqlMapClient? If not, is there other
> way to do batch?
>
> thanks,
> Tony
>
>