ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Akins, Greg" <gak...@amervideo.com>
Subject RE: Reading from different datasources in same SqlMapClient instance
Date Tue, 15 Feb 2005 15:53:07 GMT
Thanks. 

That's what I did this morning to get my tests to pass.  It seemed kinda
ugly; but I probably just need to refactor.



-----Original Message-----
From: Brandon Goodin [mailto:brandon.goodin@gmail.com] 
Sent: Tuesday, February 15, 2005 10:46 AM
To: ibatis-user-java@incubator.apache.org
Subject: Re: Reading from different datasources in same SqlMapClient
instance


There is no way to accomplish this with the resultmap. You could simply
get your list with the select and then iterate over it and populate the
complex property (mold) by calling getMoldById statement.

Brandon


On Tue, 15 Feb 2005 08:36:50 -0500, Akins, Greg <gakins@amervideo.com>
wrote:
> Maybe I didn't express myself well enough in my last post.
> 
> I have a SqlMap that has a select attribute on the result, so that the

> Collection is read from another statement.
> 
> What I'd really like to be able to do, is use a Java class (instead of

> a sql statement), so I can get the collection from another datasource.
> 
> Is there a way to force Ibatis to execute a Java method to populate a 
> result set, instead of just using the SqlMaps?
> 
> <resultMap id="getWareResult" class="ware" >
> <result property="id" column="WareId" />
> <result property="laserId" column="LaserId" />
> <result property="mold" column="mold_id" select="getMoldById" /> 
> <result property="avpId" column="AvpId" /> </resultMap>
> <statement id="getWares" resultMap="getWareResult" >
> select WareId, LaserId, MoldId, AvpId
> from Ware
> where AvpId = #id#
> </statement>
> 
> Greg Akins
> Software Engineer
> Sony Electronics, STP Systems
> 724.696.7322 (Sony)
> 724.696.6147 (AV)
> 724.454.7790 (Cell)
> 412.590.3973 (Pager)
>

Mime
View raw message