<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000099">
Sorry, misunderstood. I see what you're saying, but I can't answer
that one. <br>
<br>
Diran<br>
<br>
Daniel Pitts wrote:
<blockquote
cite="mid7E4302A18925394BAC32C7AD1ABE75D4E2FB29@CNET6.cnet.cnwk"
type="cite">
<title></title>
<meta http-equiv="Content-Type" content="text/html; ">
<meta content="MSHTML 6.00.2900.2963" name="GENERATOR">
<div align="left" dir="ltr"><span class="993184520-12092006"><font
color="#0000ff" face="Arial" size="2">To clarify more,</font></span></div>
<div align="left" dir="ltr"><span class="993184520-12092006"><font
color="#0000ff" face="Arial" size="2">I have a bunch of beans of
different classes. There is a table for each class of bean, with
columns that correspond directly to bean properties. This makes it easy
to do things like <select id="getAuthors"
resultClass="author">SELECT * from authors</select></font></span></div>
<div align="left" dir="ltr"><span class="993184520-12092006"></span> </div>
<div align="left" dir="ltr"><span class="993184520-12092006"><font
color="#0000ff" face="Arial" size="2">What I'd like to do is something
like</font></span></div>
<div align="left" dir="ltr"><span class="993184520-12092006"><font
color="#0000ff" face="Arial" size="2"><select id="getSomething"
resultClass="$resultClass$" remapResults="true">SELECT * FROM
$table$</select></font></span></div>
<br>
<div class="OutlookMessageHeader" align="left" dir="ltr" lang="en-us">
<hr tabindex="-1"><font face="Tahoma" size="2"><b>From:</b> Daniel
Pitts [<a class="moz-txt-link-freetext" href="mailto:Daniel.Pitts@cnet.com">mailto:Daniel.Pitts@cnet.com</a>]
<br>
<b>Sent:</b> Tuesday, September 12, 2006 1:42 PM<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:user-java@ibatis.apache.org">user-java@ibatis.apache.org</a><br>
<b>Subject:</b> RE: Populating existing beans...<br>
</font><br>
</div>
<div align="left" dir="ltr"><span class="411273820-12092006"><font
color="#0000ff" face="Arial" size="2">Thanks for the reply.</font></span></div>
<div align="left" dir="ltr"><span class="411273820-12092006"><font
color="#0000ff" face="Arial" size="2"> I'm well aware of queryForMap,
but the problem isn't grouping the objects.</font></span></div>
<div align="left" dir="ltr"><span class="411273820-12092006"></span> </div>
<div align="left" dir="ltr"><span class="411273820-12092006"><font
color="#0000ff" face="Arial" size="2">Basically, I have a bean "graph"
(or tree, or whatever) that has been constructed before there is enough
information to run the final query. Also, I don't know the bean class
before hand (and don't want to add it explicitly to the resultMap or
resultClass argument)</font></span></div>
<div align="left" dir="ltr"><span class="411273820-12092006"></span> </div>
<div align="left" dir="ltr"><span class="411273820-12092006"><font
color="#0000ff" face="Arial" size="2">As an alternative solution to my
problem, if there was a way to do a queryForList, but specify the
result class at runtime, that would be extremely helpful.</font></span></div>
<br>
<div class="OutlookMessageHeader" align="left" dir="ltr" lang="en-us">
<hr tabindex="-1"><font face="Tahoma" size="2"><b>From:</b>
<a class="moz-txt-link-abbreviated" href="mailto:Adediran.Ayandele@Sun.COM">Adediran.Ayandele@Sun.COM</a>
[<a class="moz-txt-link-freetext" href="mailto:Adediran.Ayandele@Sun.COM">mailto:Adediran.Ayandele@Sun.COM</a>]
<br>
<b>Sent:</b> Tuesday, September 12, 2006 1:24 PM<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:user-java@ibatis.apache.org">user-java@ibatis.apache.org</a><br>
<b>Subject:</b> Re: Populating existing beans...<br>
</font><br>
</div>
Daniel, there is queryForMap functionality in iBatis. It looks like
this: SqlMapExecutor.queryForMap(statementName, parameterObject, key).
The key will be a column in your result map which could be your bean.id
property after the result map populates the bean. I am not sure what
you mean by populating existing beans, but I hope this helps.<br>
<br>
Diran<br>
<br>
Daniel Pitts wrote:
<blockquote
cite="mid7E4302A18925394BAC32C7AD1ABE75D4E2FB08@CNET6.cnet.cnwk"
type="cite">
<pre wrap="">I have a
Map<Integer, MyBean> byId;
Which was built by "byId.put(myBean.getId(), myBean);"
MyBean is the base class, there are many types of "MyBean" objects.
Is there a away to tell iBATIS to use the bean in "byId" map as the
result object? Or do I have to get the result, and copy the values over
myself?
I know it can be done with queryForObject(String, Object, Object); but I
need it for something like queryForList or queryForMap
Thanks,
Daniel.
</pre>
</blockquote>
</blockquote>
</body>
</html>
|