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.


-----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">
      SELECT facility_service_desc, facility_service_code
      FROM facility_service_lookup

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 =

Can this be done?  Am I calling them incorrectly?


jay blanton
View this message in context:
Sent from the iBATIS - User - Java forum at Nabble.com.

View raw message