ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guido GarcĂ­a Bernardo <ggb...@tid.es>
Subject queryForMap key not working as expected
Date Wed, 08 Mar 2006 17:52:01 GMT
Hello, I'm in trouble with this method.

My statement is as simple as:
    <statement id="foo_query" resultClass="java.util.HashMap">
    select '1' as key, 'France' as country, 'yes' as eu from dual
    union
    select '2' key, 'Spain' as country, 'yes' as eu from dual
    </statement>

When I do:
    Map map = getSqlMapExecutor().queryForMap("foo_query", null, "key");

The logs are fine, returning two records:
DEBUG 18:36:25,390 [TP-Processor5 Connection] - {conn-100007} Connection
DEBUG 18:36:25,406 [TP-Processor5 PreparedStatement] - {pstm-100008} 
PreparedStatement:   select '1' as key, 'France' as country, 'yes' as eu 
from dual  union  select '2' key, 'Spain' as country, 'yes' as eu from 
dual 
DEBUG 18:36:25,406 [TP-Processor5 PreparedStatement] - {pstm-100008} 
Parameters: []
DEBUG 18:36:25,406 [TP-Processor5 PreparedStatement] - {pstm-100008} 
Types: []
DEBUG 18:36:25,437 [TP-Processor5 ResultSet] - {rset-100009} ResultSet
DEBUG 18:36:25,453 [TP-Processor5 ResultSet] - {rset-100009} Header: 
[KEY, COUNTRY, EU]
DEBUG 18:36:25,453 [TP-Processor5 ResultSet] - {rset-100009} Result: [1, 
France, yes]
DEBUG 18:36:25,453 [TP-Processor5 ResultSet] - {rset-100009} Result: [2, 
Spain, yes]

But if I debug into the map, its key is null and there is only one record !
{null={COUNTRY=Spain, EU=yes, KEY=2}}

Where could be the problem?
Thank you very much in advance,
Guido.

Mime
View raw message