Unfortunately that doesn't work either.

The question in really simple terms:

What should be the result map for this class:

class Attribute {
    String name;
    List<String> values;
}



cbchhaya wrote:
> 
> Almost, except that I am already using a result-mapping to get all
> attributes for an object, and every attribute has a bunch of fields, one
> of which is a list of strings. Having already selected all the required
> data, I am just looking for a way to bunch up the 'attrValue' field into a
> list of strings. Perhaps I should group by every other property of the
> attribute?
> 
> 
> 
> Gwyn wrote:
>> 
>> 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<[email protected]> 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.
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/String-list-in-resultMap-tp23954863p23967886.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

Reply via email to