ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Bradshaw <gbrads...@davisvision.com>
Subject Re: A question about Map results??
Date Thu, 17 Nov 2005 14:38:32 GMT
Hi, Xinyu.

You can specify a nested resultMap for the bean property instead of a column.

Of course, in your example, you could just map directly to the bean and not 
use a HashMap at all, since the bean is the only property in the map. But 
you could have more beans or other non-bean properties in the map, in which 
case you'd use a nested resultMap for each bean.

   - gary

At 03:32 AM 11/17/2005, =?gb2312?B?1cX2ztPu?= wrote:
>"urn:schemas-microsoft-com:office:office" xmlns:w = 
>"urn:schemas-microsoft-com:office:word">
>
>HI,
>
>if the resultMap class is a HashMap,and a property in it is a javabean 
>class,it has serval properties. How to set the resultMap for the property?
>
>I write the resultMap like under,but it doesn't work.
>
>  <resultMap id="result-map" class="java.util.HashMap">
>       <result property="product" 
> javaType="¡±com.ibatis.example.Product¡±" 
> column="{id=PRD_ID,description=PRD_DESCRIPION}" />
>  </resultMap>
>
>  <statement id="sqlTest" resultMap="result-map">
>        select PRD_ID,PRD_DESCRIPION from product
>  </statement>
>
>How to set the product property?
>
>xinyu
>
>



------------------------------------------------------------------------
The information contained in this communication is intended
only for the use of the recipient(s) named above. It may
contain information that is privileged or confidential, and
may be protected by State and/or Federal Regulations. If
the reader of this message is not the intended recipient,
you are hereby notified that any dissemination,
distribution, or copying of this communication, or any of
its contents, is strictly prohibited. If you have received
this communication in error, please return it to the sender
immediately and delete the original message and any copy
of it from your computer system. If you have any questions
concerning this message, please contact the sender.
------------------------------------------------------------------------

Mime
View raw message