ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roan <rosulli...@oberonassociates.com>
Subject Re: Can I use Map or XML result in mapping complex properties
Date Mon, 29 Jan 2007 23:19:10 GMT

Hi,

I have been trying to do the same with XML resultMaps, and I *think* I
figured it out. Have not tested this exhaustively, but got expected results
from last couple of junit's I ran.

Key is the "xmlCollection" type alias, which is registered in
com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser#registerDefaultTypeAliases 

Armed with that (undocumented?) type alias, I declared the following in my
xml resultMap:
    <result property="locations" column="locid" javaType="xmlCollection"
select="MYINFO.findLocationById" />

This is how my findLocationById statement is declared:
   <resultMap id="locationXmlResult" class="xml" xmlName="location" >
       ... 
   </resultMap>   
   <select id="findLocationsById" resultMap="locationXmlResult"
parameterClass="java.lang.String">
       ....
   </select>

I'm curious if this approach to "xmlCollection" properties is documented
anywhere, or at least whether this is how it is intended to work. Haven't
been able to find anything on the lists ... any iBATIS experts out there who
can say one way or the other?

Obviously current setup doesn't solve the N+1 selects problem. That's the
next step. 

For the record ... I know a lot of changes are being considered for 3.0
(especially around XML), and just want to let you guys know that (on a 
current project) the iBATIS XML support has made it possible to put together
a data access layer that populates XML Beans from an RDBMS with a bare
minimum of plumbing. It's actually quite elegant. Without being able to
return XML, it would not be possible to populate XML Beans through the
iBATIS framework since there are no default constructors in XML Beans. My
two cents.

Roan



Shepherdz wrote:
> 
> Our project needs to use generic result structure to recieve results of a
> query, i.e. Map or XML. How can I use Map or XML result in mapping complex
> properties? 
>  ....  
> 

-- 
View this message in context: http://www.nabble.com/Can-I-use-Map-or-XML-result-in-mapping-complex-properties-tf1661124.html#a8700325
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message