00问答网
所有问题
Mybatis 的foreach 可以嵌套吗
如题所述
举报该问题
推荐答案 2014-12-12
å®æ¹ç»çtestæ¯å¯ä»¥ç
<select id="nestedSelect" parameterType="Parameter" resultType="map">
select *
from names
<where>
<foreach collection="names" item="name" separator="or">
<foreach collection="name.firstNames" item="firstName" separator="or">
(lastName = #{name.lastName} and firstName = #{firstName})
</foreach>
</foreach>
</where>
</select>
http://code.google.com/p/mybatis/source/browse/trunk/src/test/java/org/apache/ibatis/submitted/nested/?r=3467
Junit Test
NestedForEachTest.java
NestedForEach.xml
温馨提示:答案为网友推荐,仅供参考
当前网址:
http://00.wendadaohang.com/zd/0DDeTjBBIjBBr0Bjej.html
相似回答
Mybatis
的foreach
可以嵌套吗
答:
官方给的test是可以的 select from names <where> <
foreach
collection="names" item="name" separator="or"> <foreach collection="name.firstNames" item="firstName" separator="or"> (lastName = #{name.lastName} and firstName = #{firstName})</foreach> </foreach> </where> h...
mybatis
foreach
标签
答:
综上,collection能够指定的值就是M中最终存在的key,<
foreach
>标签从M中拿到key的value,然后遍历value,所以这个value必须是能够被遍历的对象。以上都是假设你没有在Mapper的接口方法上使用
mybatis
提供的注解 org.apache.ibatis.annotations.Param 注解参数名时collection的默认值,如果你在参数上使用了这个...
Mybatis
批量更新 ORA-00911: 无效字符的错误
答:
Mybatis
会打印的sql语句如下,并且报错 上述语句是合法的SQL语句,并且放到SQL工具
中可以
执行。 错误的原因是Mybatis不能识别这是批量操作的2条语句,紧靠;号不能完成 解决办法: 增加
foreach
节点的操作符 foreach加入open和close配置 新打印的SQL将会如下所示:
mybatis
批量操作数据
答:
mybatis的
批量操作有两种方式,一是使用
foreach
标签,二是使用mybatis的BATCH模型 在xml中通过foreach对表数据进行循环操作 在oracle中不支持insert into product(name, type, price) values ('a', 'tv', 1233), ('b', 'ac', 3455),...('','','')这种形式的sql,因此oracle批量插入使用 in...
大家正在搜
array foreach
shell foreach
for和foreach
jqueryforeach用法
foreach index
jquery遍历foreach
jsp foreach
js foreach
foreach in
相关问题
foreach mybatis能遍历map吗
Mybatis 的foreach 可以嵌套吗
Mybatis 的foreach 可以嵌套吗
mybatis mapper.xml 里的<if>...
mybatis foreach index 可以做为条件使用...
mybatis foreach map中存在list
Mybatis foreach的问题 配置: