Rashid, In short, each row of the query result set is mapped to a new instance of the "resultClass" class parameter you have specified when you call slqMap.queryForList(). In sqlMap.queryForObject(), it maps a SINGLE row to a new instance of the "resultClass" class parameter. I can't think of any reason why you would want to map a single row to a new instance of a List.
Lewis Dawson -----Original Message----- From: Larry Meadors [mailto:[email protected]] Sent: Friday, February 20, 2009 11:26 AM To: Rashid Jilani Cc: [email protected] Subject: Re: returning an array List Look in the users guide. Please. :) On Fri, Feb 20, 2009 at 12:11 PM, Rashid Jilani <[email protected]> wrote: > Thanks Larry it helped but I have a quick question. > > Why I can't do this > > <select id="getTradeList" resultClass="java.util.List"> > > sqlMap.queryForObject("getTradeList"); > > -----Original Message----- > From: Larry Meadors [mailto:[email protected]] > Sent: Friday, February 20, 2009 12:39 PM > To: [email protected] > Subject: Re: returning an array List > > Try this: > > <select id="getTradeList" resultClass="string"> > > return sqlMap.queryForList("getTradeList"); > > Larry > > >
