ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Normad2" <norm...@gmx.de>
Subject AW: Map of Lists
Date Tue, 14 Aug 2007 06:54:28 GMT
Hi George,
 
have you allready tried to implement a RowHandler?

public class TestRowHandler implements RowHandler {
    private Map<Type, Value> map = new HashMap<Type, Value>();
 
    public void handleRow(Object valueObject) {
        Entity row = (Entity)valueObject;
        map.put(row.class, row);
    }
 
    public Map<Type, Value> getMap(){
        return this.map;
    }
}

 
Then you can use it like this:

TestRowHandler rh = new TestRowHandler();
sqlMapClient().queryWithRowHandler("your.statementid", rh);
rh.getMap();

 
Best regards, Tilo

  _____  

Von: George Dawoud [mailto:gdawoud@real.com] 
Gesendet: Dienstag, 14. August 2007 03:29
An: user-java@ibatis.apache.org
Betreff: Map of Lists


Hi All, 

can someone tell me if this can be done...

QRY

Select type, name 
from table
order by type, name

where the result will be

TYPE NAME
type1 aaa
type1 bbb
type2 ccc
type3 axzd


I want a map with 3 Keys (type1, type2, and type3) and the value of each Key
is the list or Names?

can this be done... i tried this and no luck

<resultMap id="get-types" class="java.util.HashMap" groupBy="key">
<result property="key" column="name" />
<result property="val" resultMap="get-names"/>
</resultMap>







<resultMap id="get-names" class="java.util.ArrayList">
<result property="name" resultMap="name" />
</resultMap>




<select id="retrieveRelatedTo" resultMap="get-cnt-cnt-connections">
Select type, name 
from table
order by type, name
</select>


Thanks
George 


Mime
View raw message