ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yee, Richard K CTR DMDC" <Richard.Yee....@osd.pentagon.mil>
Subject RE: Return result as Map
Date Wed, 21 Jun 2006 20:22:32 GMT
It sounds to me like you should be using the queryForList() method instead
of queryForMap(). You will then get a list of Maps with each map
representing a row in the table.

-Richard


-----Original Message-----
From: jaybytez [mailto:jaybytez@gmail.com] 
Sent: Wednesday, June 21, 2006 8:12 AM
To: user-java@ibatis.apache.org
Subject: Return result as Map



I maybe misunderstanding queryForMap which seems to return a Map that
contains a key you specify and a full object or result in the value.  What I
am looking to do is actually return a Map from a query that places a key and
value in a Map (key being = to one column) and (value being = to another
column).  I have the following query:

  <select id="selectFacilityServiceLookup" resultClass="java.util.Map">
    <![CDATA[
      SELECT facility_service_desc, facility_service_code
      FROM facility_service_lookup
    ]]>
  </select>

I would like a Map that contains a row for each record and the key for the
map to be facility_service_desc and the value for the map to be
facility_service_code.  I am calling this template using the queryForMap
with the Object = null, and the key = facility_service_desc, and the value =
facility_service_code.

Can this be done?  Am I calling them incorrectly?

Thanks,

jay blanton
--
View this message in context:
http://www.nabble.com/Return-result-as-Map-t1824496.html#a4976185
Sent from the iBATIS - User - Java forum at Nabble.com.

Mime
View raw message