0

I have an user model like this:

class User { 
   private int id;
   private String name;
   private String password;
}

Now I am trying to get some users by user ids;

The result I want is a hashMap like this:

key id 10001 value user1

key id 10002 value user2

and then I can select the user by id and set to the topic.

topic.setUser(resultMap.get(id));

my config file:

<select id="getUsers"  >
   select id, name, password from user
   where id in
   <foreach item="id" index="index" collection="list"   open="("  separator="," close=")">
      #{id}  
   </foreach>
</select>

Now the question is How to return a map and the key is id and value is the user object

thanks in advance :)

Felix
  • 1,253
  • 7
  • 22
  • 41

0 Answers0