ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbchhaya <cbchh...@gmail.com>
Subject String list in resultMap
Date Wed, 10 Jun 2009 02:59:27 GMT

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