﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-落叶归根-文章分类-iBATIS</title><link>http://www.blogjava.net/allan-oy/category/7180.html</link><description>一个人首先要尊重别人，然后才能得到别人的尊重；一个人首先要对自己负责，然后才有资格去对别人负责。</description><language>zh-cn</language><lastBuildDate>Fri, 02 Mar 2007 02:52:57 GMT</lastBuildDate><pubDate>Fri, 02 Mar 2007 02:52:57 GMT</pubDate><ttl>60</ttl><item><title>iBATIS SQL Maps 是怎样从数据库按照 one-to-many 关系查询数据的</title><link>http://www.blogjava.net/allan-oy/articles/28997.html</link><dc:creator>落叶归根</dc:creator><author>落叶归根</author><pubDate>Mon, 23 Jan 2006 04:13:00 GMT</pubDate><guid>http://www.blogjava.net/allan-oy/articles/28997.html</guid><wfw:comment>http://www.blogjava.net/allan-oy/comments/28997.html</wfw:comment><comments>http://www.blogjava.net/allan-oy/articles/28997.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/allan-oy/comments/commentRss/28997.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/allan-oy/services/trackbacks/28997.html</trackback:ping><description><![CDATA[<TABLE style="WIDTH: 527px; HEIGHT: 456px" height=456 cellSpacing=0 cellPadding=0 width=527 border=1>
<TBODY>
<TR>
<TD>
<P><FONT size=2>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</FONT></P>
<P><FONT size=2>&lt;!DOCTYPE sqlMap<BR>&nbsp;&nbsp;&nbsp; PUBLIC "-//<A class=keyword href="http://sg.kehui.net/index.php?op=article&amp;action=keyword&amp;keyword=iBATIS">iBATIS</A>.com//DTD <A class=keyword href="http://sg.kehui.net/index.php?op=article&amp;action=keyword&amp;keyword=SQL">SQL</A> Map 2.0//EN"<BR>&nbsp;&nbsp;&nbsp; "</FONT><A href="http://www.ibatis.com/dtd/sql-map-2.dtd"><FONT size=2>http://www.ibatis.com/dtd/sql-map-2.dtd</FONT></A><FONT size=2>"&gt;</FONT></P>
<P><FONT size=2>&lt;sqlMap&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;resultMap id="get-autoInfo-result" class="bo.AutoInfo"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;result property="id" column="auto_id"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;result property="licensePlate" column="license_plate"/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/resultMap&gt;</FONT></P>
<P><FONT size=2>&nbsp;&nbsp;&nbsp; &lt;resultMap id="get-people-result" class="bo.People"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;result property="id" column="owner_id"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;result property="name" column="name"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;result property="address" column="address"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;result property="autoInfoList" column="owner_id" select="getAutoInfo"/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/resultMap&gt;</FONT></P>
<P><FONT size=2>&nbsp; &lt;select id="getPeople" resultMap="get-people-result" parameterClass="bo.People"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;![CDATA[ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select * from people where owner_id=#id#<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ]]&gt;<BR>&nbsp; &lt;/select&gt;</FONT></P>
<P><FONT size=2>&nbsp; &lt;select id="getAutoInfo" resultMap="get-autoInfo-result" parameterClass="int"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;![CDATA[ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select * from auto_info where owner_no=#id#<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ]]&gt;<BR>&nbsp; &lt;/select&gt;<BR>&lt;/sqlMap&gt;</FONT></P></TD></TR></TBODY></TABLE>&nbsp;
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: Arial">resultMap id="get-autoInfo-result" class="bo.AutoInfo"</SPAN></B><SPAN lang=EN-US style="FONT-FAMILY: Arial"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>resultMap </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">是</SPAN><SPAN style="FONT-FAMILY: Arial"> <SPAN lang=EN-US><A class=keyword href="http://sg.kehui.net/index.php?op=article&amp;action=keyword&amp;keyword=iBATIS">iBATIS</A> <A class=keyword href="http://sg.kehui.net/index.php?op=article&amp;action=keyword&amp;keyword=SQL">SQL</A> Maps </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">框架中重要组件之一，</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">你也许还记得</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> </SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">resultClass </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">吧？两者概念基本一致。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">resultMap </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">则是可定制</SPAN><SPAN style="FONT-FAMILY: Arial"> </SPAN><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">Mapped Statement </SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">返回对象的。可定制表现在：比如我有一张数据表包含</SPAN><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">10</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">个字段，但我的</SPAN><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> POJO </SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">只定义了</SPAN><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">5</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">个属性，这时，只要取出我关心的字段就行。和</SPAN><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> Hibernate </SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">类似，</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">resultMap </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">的</SPAN><SPAN style="FONT-FAMILY: Arial"> <B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>result</SPAN></B><SPAN lang=EN-US> </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">元素定义了</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"> POJO </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">属性到数据表字段的映射。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">需要说明的是</SPAN><SPAN style="FONT-FAMILY: Arial"> <B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>result</SPAN></B><SPAN lang=EN-US> </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">元素</SPAN><SPAN style="FONT-FAMILY: Arial"> <B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>select</SPAN></B></SPAN><SPAN lang=EN-US> </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性，该属性类似于加载了一个子查询，并自动载入，如果这个子查询包含多条结果，就自动把结果装载进</SPAN> <SPAN lang=EN-US style="FONT-FAMILY: Arial">List</SPAN><SPAN lang=EN-US> </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类型。该</SPAN> <B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: Arial">result</SPAN></B><SPAN lang=EN-US style="FONT-FAMILY: Arial"> </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">元素</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对应</SPAN> <SPAN lang=EN-US style="FONT-FAMILY: Arial">People</SPAN><SPAN lang=EN-US> </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的属性为</SPAN><SPAN lang=EN-US>”</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">autoInfoList”</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，而由</SPAN> <SPAN lang=EN-US style="FONT-FAMILY: Arial">Hibernate</SPAN><SPAN lang=EN-US> </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">生成的</SPAN> <SPAN lang=EN-US style="FONT-FAMILY: Arial">People</SPAN><SPAN lang=EN-US> </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">却是</SPAN> <SPAN lang=EN-US style="FONT-FAMILY: Arial">Set</SPAN><SPAN lang=EN-US> </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类型</SPAN><SPAN lang=EN-US>”</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">autoInfoSet”</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，这两种类型无法直接互转，所以我修改了</SPAN><SPAN lang=EN-US> POJO </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性。</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: Arial">select id="getPeople" resultMap="get-people-result" parameterClass="bo.People"<o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">此为</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"> <SPAN lang=EN-US>select </SPAN></SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">类型</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">Mapped Statement</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">。传入</SPAN><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> People </SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">实例，返回为自己定制、包含</SPAN><SPAN lang=EN-US>”</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">autoInfoList”</SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">的</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> <SPAN lang=EN-US>People </SPAN></SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">实例。传入</SPAN><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">People </SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">类型参数是为了便于多字段匹配查询，今天也许我只需利用</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> <SPAN lang=EN-US>People.id </SPAN></SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">单字段匹配就能得到结果，但下次的新需求也许是</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> <SPAN lang=EN-US>People.address </SPAN></SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">和</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> <SPAN lang=EN-US>People.name </SPAN></SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">联合匹配！</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">相应程序代码：</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p>
<TABLE style="WIDTH: 525px; HEIGHT: 386px" height=386 cellSpacing=0 cellPadding=0 width=525 border=1>
<TBODY>
<TR>
<TD>
<P><FONT size=2>package test;</FONT></P>
<P><FONT size=2>import java.io.Reader;<BR>import java.util.List;</FONT></P>
<P><FONT size=2>import com.ibatis.sqlmap.client.*;<BR>import com.ibatis.common.resources.*;</FONT></P>
<P><FONT size=2>import bo.*;</FONT></P>
<P><FONT size=2>public class AutoMag {</FONT></P>
<P><FONT size=2>&nbsp;private Reader reader;<BR>&nbsp;private People people=new People();<BR>&nbsp;private SqlMapClient sqlMap;<BR>&nbsp;private String resource = "SqlMapConfig.xml";<BR>&nbsp;<BR>&nbsp;public People findPeople() throws Exception{<BR>&nbsp;&nbsp;reader = Resources.getResourceAsReader(resource);<BR>&nbsp;&nbsp; sqlMap=SqlMapClientBuilder.buildSqlMapClient(reader);<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp; people.setId(new Integer("1"));<BR>&nbsp;&nbsp; <FONT color=#ff0000>people=(People)sqlMap.queryForObject("getPeople",people);</FONT><BR>&nbsp;&nbsp; return people;<BR>&nbsp;}<BR>}</FONT></P></TD></TR></TBODY></TABLE>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: Arial">sqlMap.queryForObject(String arg0, Object arg1)<o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">此方法类似</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"> Hibernate </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">的</SPAN><SPAN style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"> <SPAN lang=EN-US>session.load(…)</SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">，传入</SPAN><SPAN style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">Mapped Statement id</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">，再传入包含主键的对象实例。除我上面列举的</SPAN><SPAN style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"> <SPAN lang=EN-US>sqlMap.</SPAN></SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">queryForObject(String arg0, Object arg1) </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">外，还有重载方法</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">：</SPAN><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p>
<TABLE style="WIDTH: 521px; HEIGHT: 69px" height=69 cellSpacing=0 cellPadding=0 width=521 border=1>
<TBODY>
<TR>
<TD>
<P><FONT color=#ff0000 size=2>people=(People)sqlMap.queryForObject("getPeople",people);</FONT></P>
<P><FONT size=2>替换成</FONT></P>
<P><FONT color=#ff0000 size=2>sqlMap.queryForObject("getPeople", people, people);</FONT></P></TD></TR></TBODY></TABLE>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第一个</SPAN><SPAN lang=EN-US>”</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">people</SPAN><SPAN lang=EN-US>”</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是传入参数，第二个</SPAN><SPAN lang=EN-US>”</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">people</SPAN><SPAN lang=EN-US>”</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是返回的结果。</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">要表达的意思一样，只不过换了种表现形式</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">下面我会讲到如何以集合类持有多个</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: Arial"> People </SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">对象实例。</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">在车辆管理应用中，需要把人员一一列出，选中某个再显示详细内容。类似于这样的需求，</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><A class=keyword href="http://sg.kehui.net/index.php?op=article&amp;action=keyword&amp;keyword=iBATIS">iBATIS</A> <A class=keyword href="http://sg.kehui.net/index.php?op=article&amp;action=keyword&amp;keyword=SQL">SQL</A> Maps </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">引入</SPAN><SPAN style="FONT-FAMILY: Arial"> <SPAN lang=EN-US>sqlMap.queryForList(String arg0, Object arg1) </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">来满足。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">还记得我们的映射文件怎么写的？对了，传入主键值再查询！</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">但是，新需求不要任何条件，直接列出人员啊！难道还要再添加新的</SPAN><SPAN style="FONT-FAMILY: Arial"> </SPAN><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">Mapped Statement </SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">来满足？动态</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> <SPAN lang=EN-US>Mapped Statement </SPAN></SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">能满足在不改变映射文件的前提下提供有参数和无差数查询：</SPAN><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p>
<TABLE style="WIDTH: 528px; HEIGHT: 597px" height=597 cellSpacing=0 cellPadding=0 width=528 border=1>
<TBODY>
<TR>
<TD>
<P><FONT size=2>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</FONT></P>
<P><FONT size=2>&lt;!DOCTYPE sqlMap<BR>&nbsp;&nbsp;&nbsp; PUBLIC "-//<A class=keyword href="http://sg.kehui.net/index.php?op=article&amp;action=keyword&amp;keyword=iBATIS">iBATIS</A>.com//DTD <A class=keyword href="http://sg.kehui.net/index.php?op=article&amp;action=keyword&amp;keyword=SQL">SQL</A> Map 2.0//EN"<BR>&nbsp;&nbsp;&nbsp; "</FONT><A href="http://www.ibatis.com/dtd/sql-map-2.dtd"><FONT size=2>http://www.ibatis.com/dtd/sql-map-2.dtd</FONT></A><FONT size=2>"&gt;</FONT></P>
<P><FONT size=2>&lt;sqlMap&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;resultMap id="get-autoInfo-result" class="bo.AutoInfo"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;result property="id" column="auto_id"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;result property="licensePlate" column="license_plate"/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/resultMap&gt;</FONT></P>
<P><FONT size=2>&nbsp;&nbsp;&nbsp; &lt;resultMap id="get-people-result" class="bo.People"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;result property="id" column="owner_id"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;result property="name" column="name"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;result property="address" column="address"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;result property="autoInfoList" column="owner_id" select="getAutoInfo"/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/resultMap&gt;</FONT></P>
<P><FONT size=2>&nbsp; &lt;select id="getPeople" resultMap="get-people-result" parameterClass="bo.People"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;![CDATA[ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select * from people<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ]]&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;dynamic prepend="where"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;isNotNull property="id"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;![CDATA[ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; owner_id=#id#<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ]]&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/isNotNull&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/dynamic&gt;<BR>&nbsp; &lt;/select&gt;</FONT></P>
<P><FONT size=2>&nbsp; &lt;select id="getAutoInfo" resultMap="get-autoInfo-result" parameterClass="int"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resultClass="bo.AutoInfo"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;![CDATA[ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select * from auto_info where owner_no=#id#<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ]]&gt;<BR>&nbsp; &lt;/select&gt;<BR>&lt;/sqlMap&gt;</FONT></P></TD></TR></TBODY></TABLE>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: Arial">dynamic prepend="where"<o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0"><SPAN lang=EN-US style="FONT-FAMILY: Arial">select</SPAN><SPAN lang=EN-US> </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类型</SPAN> <SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">Mapped Statement </SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">的本质并无改变，只是通过</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> </SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">dynamic </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">元素定义了动态</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"> where </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">子句。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">dynamic </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">元素属性</SPAN><SPAN style="FONT-FAMILY: Arial"> <SPAN lang=EN-US>prepend=”where”</SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">在一元判定元素</SPAN><SPAN style="FONT-FAMILY: Arial"> <SPAN lang=EN-US>isNotNull </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">返回</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">”true”</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">时有效。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">isNotNull </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">元素属性</SPAN><SPAN style="FONT-FAMILY: Arial"> <SPAN lang=EN-US>property="id" </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">用于判定</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"> People.id </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">是否为</SPAN><SPAN style="FONT-FAMILY: Arial"> <SPAN lang=EN-US>null</SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">，假如未传入包含主键值的</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"> People </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">实例，</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">dynamic </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">元素将会无效，反之则亦然，这样就达到了在不改变映射文件的前提下实现动态</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"> <A class=keyword href="http://sg.kehui.net/index.php?op=article&amp;action=keyword&amp;keyword=SQL">SQL</A> </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">的目的。关于一元判定元素和二元判定元素的详细资料请查阅官方文档，如能恰当利用这些判定元素，动态</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"> <A class=keyword href="http://sg.kehui.net/index.php?op=article&amp;action=keyword&amp;keyword=SQL">SQL</A> </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">将会更灵活。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">相应程序代码：</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p>
<TABLE style="WIDTH: 528px; HEIGHT: 374px" height=374 cellSpacing=0 cellPadding=0 width=528 border=1>
<TBODY>
<TR>
<TD>
<P><FONT size=2>package test;</FONT></P>
<P><FONT size=2>import java.io.Reader;<BR>import java.util.List;</FONT></P>
<P><FONT size=2>import com.ibatis.sqlmap.client.*;<BR>import com.ibatis.common.resources.*;</FONT></P>
<P><FONT size=2>import bo.*;</FONT></P>
<P><FONT size=2>public class AutoMag {</FONT></P>
<P><FONT size=2>&nbsp;private Reader reader;<BR>&nbsp;private People people=new People();<BR>&nbsp;private SqlMapClient sqlMap;<BR>&nbsp;private String resource = "SqlMapConfig.xml";<BR>&nbsp;<BR>&nbsp;public List findPeople() throws Exception{<BR>&nbsp;&nbsp;reader = Resources.getResourceAsReader(resource);<BR>&nbsp;&nbsp;sqlMap=SqlMapClientBuilder.buildSqlMapClient(reader);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;<FONT color=#ff0000>List list=sqlMap.queryForList("getPeople",null);</FONT><BR>&nbsp;&nbsp;return list;<BR>&nbsp;}<BR>}</FONT></P></TD></TR></TBODY></TABLE>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">传入</SPAN><SPAN style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">Mapped Statement id</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">，再传入未包含主键的对象实例，也可以干脆传</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"> null </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">进去。重载方法</SPAN><SPAN style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"> </SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">sqlMap</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">.queryForList(String arg0, Object arg1,<CODE><SPAN style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt; mso-ansi-font-size: 10.5pt"> int arg2, int arg3</SPAN></CODE>) </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">用于分页</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">，</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">arg2</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">、</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">arg3</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">分别代表页码和每页个数。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">好了，使用动态</SPAN><SPAN style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> <SPAN lang=EN-US style="COLOR: black">Mapped Statement</SPAN></SPAN><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.5pt">，再试试</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt"> </SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial">queryForObject(String arg0, Object arg1) </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">吧！<BR></SPAN><SPAN lang=EN-US style="FONT-FAMILY: Arial"><o:p><BR><BR><STRONG><FONT face=宋体 color=#ff0000 size=2>（请注意！引用、转贴本文应注明原作者：Rosen Jiang 以及出处：</FONT></STRONG><A href="http://blog.csdn.net/rosen"><FONT face=宋体 color=#ff0000 size=2><STRONG>http://blog.csdn.net/rosen</STRONG></FONT></A><FONT face=宋体 color=#ff0000 size=2><STRONG>）</STRONG></FONT></o:p></SPAN></P></SPAN><BR>
<DIV style="FONT-SIZE: 14px; LINE-HEIGHT: 25px"><STRONG>作者Blog：</STRONG><A id=ArticleContent1_ArticleContent1_AuthorBlogLink href="http://blog.csdn.net/rosen/" target=_blank>http://blog.csdn.net/rosen/</A></DIV><img src ="http://www.blogjava.net/allan-oy/aggbug/28997.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/allan-oy/" target="_blank">落叶归根</a> 2006-01-23 12:13 <a href="http://www.blogjava.net/allan-oy/articles/28997.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>