ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <n.beek...@wis.nl>
Subject RE: Return result as Map
Date Wed, 21 Jun 2006 17:15:00 GMT
That should work, yes. Do you get any exceptions? I believe
resultClass="java.util.Map" should be changed to a concrete
Map-implementation, for example resultClass="java.util.HashMap".


-----Original Message-----
From: jaybytez [mailto:jaybytez@gmail.com] 
Sent: woensdag 21 juni 2006 17:12
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
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
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