You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by c....@ads.it on 2007/04/13 13:40:21 UTC

queryForMap AND TypeHandler


I need to load a Map whose

      value type is an Integer
      key type is basically a String (VARCHAR2) with some syntactic rules.
      It's corresponding o-o type is NomeGruppo.java.

NomeGruppoTypeHandlerCallback is it's type handler that loads VARCHAR2
fields into well-formed objects of NomeGruppo type.

The following code works fine with String keys

      <select id="selectGruppiRadice" resultClass="java.util.HashMap">
            select
                  NOME,
                  GRUPPO_ID
            from IDENTIFICATORI_GRUPPO
            where IDENTIFICATORE_DATO.IS_NOME_OK( NOME ) = AFC_ERROR.OK
      </select>


      ...
      Map<String, Integer> lResult;
       try
       {
            lResult = (Map<String, Integer>) lSqlMapClient.queryForMap( "
selectGruppiRadice"
                                                               , null
                                                               , "NOME"
                                                               ,
"GRUPPO_ID"
                                                               );
       }
       catch (SQLException pException)
       {
      ...


I would like to load a Map<NomeGruppo, Integer> instead, using queryForMap
along with the NomeGruppoTypeHandlerCallback .

Is it possible?
Any hint?

Thanks in advance
ciao

Cesare