tags:

views:

368

answers:

2

Hi all,

I want to pass a Set of Strings in an iBatis query for the parameter map as well as return a collection of strings for the result set.

Is this possible?

Example queries ...

SELECT * FROM some_table t WHERE t.some_column IN (values);

UPDATE some_table t SET t.some_column = 'some_value' WHERE t.other_column IN (values);

Walter

A: 

For the return, In SqlMapClientTemplate there is the queryForList method.

As for the Set of String as parameter, I do not know if iBatis handles that; we built an object for that, and when I faced that problem it was in a sql in clause, so I made a loop with comma separated values.
Or you can convert the Set to an HashMap and pass that.

Alberto Zaccagni
+1  A: 

If you want to pass a List of Strings as one parameter, for example for building a IN(val1,val2...) query, then you should read about dynamic queries, in particular the Iterate element. See also.

leonbloy