ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Munat <b...@munat.com>
Subject Re: HashMap of Lists of HashMaps
Date Fri, 10 Feb 2006 16:44:51 GMT
Ooh, that's a very overloaded use of the acronym "DOM". Most people would think "Document 
Object Model". You might call it a JavaBean instead... heh, though that has its own 
perils. ;-)

Anyway, I take it the problem is that the resultMap is working with the JavaBeans (A and 
AA) but not with HashMap. What's the error, Stefan?

b

Nils Winkler wrote:
> Domain Object Model...
> 
> On Fri, 10 Feb 2006 08:06:28 -0700, "Larry Meadors"
> <lmeadors@apache.org> said:
> 
>>What do you mean by DOM?
>>
>>Larry
>>
>>
>>On 2/9/06, Ext_Friedrich, Stefan <Stefan.Friedrich@sungard.de> wrote:
>>
>>>
>>>Hello.
>>>
>>>We encountered a little problem that we are not able to solve by ourselves:
>>>
>>>What we want to do is: Use HashMaps instead of DOM in the resultMapping.
>>>Here's a sample of what we want to do:
>>>
>>><resultMap id="a" class="java.util.HashMap">
>>>        <result property="aa" select="loadAA"/>
>>>        <result property="id" column="id"/>
>>></resultMap>
>>><select id="loadA" resultMap="a">
>>>        Select id from tableA where id = 1
>>></select>
>>>
>>><resultMap id="aa" class="java.util.HashMap">
>>>        <result property="id" column="id"/>
>>></resultMap>
>>><select id="loadAA" resultMap="aa">
>>>        Select id from tableA
>>></select>
>>>
>>>The first select returns one result --> a HashMap, the second select returns
>>>numerous results --> n HashMaps that should be mapped as a List of HashMaps.
>>>
>>>When we implement it as a DOM and exchange the classes in the resultMaps
>>>with the ones below, the same code works fine:
>>>
>>>class A {
>>>        private Collection aa;
>>>        private int id;
>>>        //getters and setters
>>>}
>>>
>>>class AA {
>>>        private int id;
>>>}
>>>
>>>Is there a solution for our problem, because we want to avoid the use of a
>>>DOM due to flexibility-reasons
>>>
>>>Thanks
>>>Stefan Friedrich
> 
> --
> ==================================
> nils@nilswinkler.com
> 

Mime
View raw message