ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gwyn Evans <gwyn.ev...@gmail.com>
Subject Re: String list in resultMap
Date Wed, 10 Jun 2009 08:28:50 GMT
I'm not 100% sure, but it looks to me as if this is the subject of the
"Result Maps"/"Complex Collection Properties" section of the
"Developer Guide" document.

On Wed, Jun 10, 2009 at 3:59 AM, cbchhaya<cbchhaya@gmail.com> wrote:
>
> I have the following classes:
> class Attribute {
>    String attrName;
>    List<String> values;
> }
>
> and
>
> class DomainObj {
>    String objName;
>    String objType;
>    List<Attribute> attrs;
> }
>
> I have a database table that stores <objId, objName, objType>, another one
> that stores <attrId, attrName> and another one that stores <objId, attrId,
> attrValue> so that there are multiple rows in the final table if the
> attribute is multi-valued.
>
> A simple select returns objName, objType, attrName, attrValue but my problem
> is mapping the attrValue to a java list in the resultMap
>
> <resultMap id="..." class="DomainObj" groupBy="objName, objType>
>    <result property="objName" column="objName" />
>    ....
>    <result property="attrs" resultMap="attr-result" />
> </resultMap>
>
> <resultMap id="attr-result" class=Attribute" groupBy="attrName">
>    <result property="attrName" column="attrName" />
>    <result property="values" ....? />
> </resultMap>
>
> How do I go about mapping the 'values' property in Attribute (which is a
> List of Strings). I tried specifying the class for the result as List but it
> doesn't work and I didn't expect it to either.
>
> What is the right way of doing this? Am I overlooking something basic here?
>
> Thanks!
> --
> View this message in context: http://www.nabble.com/String-list-in-resultMap-tp23954863p23954863.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Mime
View raw message