ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diran Ayandele <Adediran.Ayand...@Sun.COM>
Subject Re: Populating existing beans...
Date Tue, 12 Sep 2006 20:24:11 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<body bgcolor="#ffffff" text="#000099">
Daniel, there is queryForMap functionality in iBatis.&nbsp; It looks like
this: SqlMapExecutor.queryForMap(statementName, parameterObject, key).&nbsp;
The key will be a column in your result map which could be your bean.id
property after the result map populates the bean.&nbsp; I am not sure what
you mean by populating existing beans, but I hope this helps.<br>
Daniel Pitts wrote:
  <pre wrap="">I have a 
Map&lt;Integer, MyBean&gt; 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

I know it can be done with queryForObject(String, Object, Object); but I
need it for something like queryForList or queryForMap


View raw message