You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "Leucht, Axel" <Ax...@prodv.de> on 2010/05/19 09:49:30 UTC
Select with dynamic where
I'm currently having one problem with iBATIS-3.
My test bed runs fine with iBATIS-2 and I have a problem with one select
statement which inserts a dynamic where clause.
The parameters, which are plain strings, are not inserted into the sql
command.
<select id="getSomeStudents" resultType="entities.Student"
parameterType="list">
select name,descr as description from student where name
in
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{value,jdbcType=VARCHAR}
</foreach>
</select>
In Java-Code
List<String> props = new ArrayList<String>();
props.add("string1");
props.add("string2");
props.add("string3");
List<Student> listStudenten =
sqlSession.selectList("Student.getEinigeStudenten", props);
The log shows that the sql don't contain the parameters given.
DEBUG [main] - ==> Executing: select name,descr as description from
student where name in ( ? , ? , ? )
DEBUG [main] - ==> Parameters: null, null, null
What is wrong with my approach?
/Axel
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org