Hi,

Is it possible to pass multiple parameters in iBatis3 without having to pass
a map or a bean ?

example :
------------- UserMapper.xml ------------
<select id="selectUsers" parameterType="hashmap" resultType="List<User>">
  SELECT * FROM user OFFSET #{offset} LIMIT #{limit}
</select>

------------- UserMapper.java -----------
public interface UserMapper {
  public List<User> selectUsers(HashMap<String, Integer> parameters);
}
-----------------------------------------

Now, I can call my statement with :


int offset = 10;
int limit = 10;

UserMapper userMapper = session.getMapper(UserMapper.class);
HashMap<String, Integer> parameters = new HashMap<String, Integer>();
parameters.put("offset", offset);
parameters.put("limit", limit);
List<Question> selections = questionMapper.selectQuestions(parameters);

------------------------------------------

I think that a cleaner way would be to do somethink like :

public interface UserMapper {
  public List<User> selectUsers(int offset, int limit);
}

UserMapper userMapper = session.getMapper(UserMapper.class);
List<Question> selections = questionMapper.selectQuestions(10, 10);

-------------------------------------------

Is there such a method to achieve it with iBatis 3 ?

Thanks,

Nicolas ANTONIAZZI.

Reply via email to