> It just requires a trivial modification in MapperMethod and a simple > mechanism to access positional parameters to get it working. For > example, MapperMethod could create a Map and put the first argument > under the key "first", the second one under "second", etc. That is, > positional access "by name". Of course, in case the number of > arguments were only one, the usual mechanism would follow.
Another possibility is to take advantage of java 5 varargs feature and allow SqlSession methods to accept multiple parameters with Object...: Object selectOne(String statement, Object... parameters); (Of course, the currently overloaded selectOne: Object selectOne(String statement); Object selectOne(String statement, Object parameter); would be merged into the single method above). As before, when length > 1 the varargs will be automatically stored into a Map under "positional" keys like "arg1", "arg2", etc (I'm not sure if the shorter "1", "2", etc are compatible with javabeans as in "bean.1", "bean.2"). This way MapperMethod will just forward its Object[] args to the SqlSession method selectOne, selectList, etc. Notice that any change that I have proposed is absolutely backwards compatible: 1) Object... still can take single arguments. 2) If just one argument is given the { "arg1": arg1, "arg2": arg2, ...} map will not be created at all. 3) Sql expecting one argument won't need to be modified. However, SqlSession won't compile with java 1.4 or older due to the introduction of varargs. I don't know if this is a concern for ibatis 3. In that case, the proposal of my previous post doesn't suffer the same inconvenience, althought it is more limited. I would like to hear your opinion about it. Best regards -- --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org