ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pc leung <pingcheu...@gmail.com>
Subject Re: How to return a List of record?
Date Thu, 01 Dec 2005 01:30:14 GMT
I want to get a List of records by getUserProfileList.
This is my UserProfile.xml.

  <select id="getUserProfileList" parameterClass="string"
resultMap="userProfileResult">select usernm, passwd, eng_name,
chi_name, dob, join_date, creation_date, created_by, last_update_date,
last_update_by from user_profile where usernm = #usernm#</select>

  <select id="getUserProfile" parameterClass="string"
resultMap="userProfileResult">select usernm, passwd, eng_name,
chi_name, dob, join_date, creation_date, created_by, last_update_date,
last_update_by from user_profile where usernm = #usernm#</select>

I hope the first one can return a List of records and the second one
can return a single record. The only difference lies in SqlMapDao. Are
they okay?


On 12/1/05, Nathan Maves <Nathan.Maves@sun.com> wrote:
> What you have would work perfectly if you have more then one row in
> your database that have the same "usernm".  I am not sure that this
> is really what you want.  If not take out your where clause and you
> will get a result (java.util.List) of all of your users.
>
> Nathan
>
> On Nov 30, 2005, at 6:28 AM, pc leung wrote:
>
> > In table xml file, I try to return a List.
> > Is it able to return a List of object of record?
> > (I have this question because I find the return a single record have
> > the very similar setup)
> >
> > Thanks
> >
> > table xml file
> >
> >   <select id="getUserProfileList" parameterClass="string"
> > resultMap="userProfileResult">
> >     select usernm, passwd, eng_name, chi_name, dob, join_date,
> >            creation_date, created_by, last_update_date, last_update_by
> >       from user_profile
> >      where usernm = #usernm#
> >   </select>
> >
> >
> > table SqlMapDao file
> > public class UserProfileSqlMapDao extends BaseSqlMapDao implements
> > UserProfileDao {
> > ...
> >       public List getUserProfileList(String usernm) {
> >               return super.queryForList("getUserProfileList", usernm);
> >       }
>
>

Mime
View raw message