ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Qian" <daqiqi...@aol.com>
Subject Re: A couple of questions
Date Thu, 30 Mar 2006 13:34:30 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title></title>
</head>
<body>
<font face="Arial,sans-serif"><font size="2">Eric,<br>
<br>
thanks. I did that in select statement. However, aliasing doesn't work
in the resultMap. I don't know if it is due to namespace in the xml
file. btw, I used Abator to generate code. <br>
<br>
Tony<br>
<br>
<span type="cite">Eric T. Blue wrote on 3/29/2006, 5:47 PM:</span>
</font></font>
<p><font face="Arial,sans-serif" size="2"></font></p>
<blockquote type="cite"  style="border-left: thin solid blue; padding-left: 10px; margin-left:
0pt;"><font  face="Arial,sans-serif" size="2">Tony,<br>
  <br>
Try aliasing the duplicate columns.&nbsp; For example:<br>
  <br>
Select a.column1 as a_column1, b.column1 as b_column1 from table1 a,
table2 b<br>
where b.some_id = <a href="http://a.id">a.id</a><br>
  <br>
  </font>
  <div><font face="Arial,sans-serif" size="2"><span class="gmail_quote">On
3/29/06, <b class="gmail_sendername">Tony Qian</b> &lt;<a  href="mailto:daqiqian2@aol.com">daqiqian2@aol.com</a>&gt;
wrote:</span></font>
  <blockquote class="gmail_quote"  style="border-left: 1px solid rgb(204, 204, 204); margin:
0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><font  face="Arial,sans-serif" size="2"></font>
    <div style="direction: ltr;"><font face="Arial,sans-serif" size="2">
    </font><font size="2" face="Arial,sans-serif"><font  face="Arial,sans-serif">All,<br>
    <br>
Got two questions on iBATIS DAO.<br>
    <br>
1) I have two tables.&nbsp; Those two tables happen to have a column with
same name.&nbsp; 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. <br>
    <br>
&lt;resultMap id="savingCardMap" class="MemberSavingCard"
groupBy="savingCardId"&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;result property="savingCardId"
column="saving_card_id"
/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color="#0000ff">&lt;result property="expirationDate"
column="S.expiration_date" /&gt;&nbsp;&nbsp;&nbsp; // expiration_date from
saving_card
table</font><br>
&nbsp; &lt;/resultMap&gt;<br>
    <br>
&nbsp; &lt;resultMap id="couponToInforteMap" class="Coupon"
groupBy="couponId"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;result property="couponId" column="coupon_id" /&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color="#0000ff">&lt;result property="expirationDate"
column="C.expiration_date" /&gt;&nbsp; // expiration_date from coupon table</font><br>
&nbsp; &lt;/resultMap&gt;<br>
    <br>
select <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C.coupon_id,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C.expiration_date,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; S.saving_card_id,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; S.expiration_date<br>
from coupon as C, saving_card as S where ....<br>
    <br>
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?<br>
    <br>
thanks,<br>
Tony<br>
    <br>
    </font></font><font face="Arial,sans-serif" size="2">
    </font></div>
  </blockquote>
  </div>
  <font face="Arial,sans-serif" size="2"><br>
  </font></blockquote>
</body>
</html>


Mime
View raw message