2011-08-26 98 views
1

我在模型对象中有一个Set属性。Java:在ibatis中迭代一个集合

class AA{ 

     Set x; 
    } 

但是,当我尝试在ibatis xml文件中迭代Set时,出现以下异常。

The 'x' property of the AA class is not a List or Array. 

这是存在于ibatis xml文件中的东西。

<iterate property="x" open="(" close=")" conjunction=","> 

      #x[]# 

     </iterate> 

我在想什么?

回答

1

你可能想看看这个问题:Iterate list of Objects in Ibatis

他们正在谈论的是一个列表,而不是一集,但现在看来,ibatis的只支持在列表和数组迭代。

0

我刚刚检查,虽然iBatis的3 UserGuide说:“(...)需要遍历收集”,然后您指定“收集”中的foreach标记字段,不支持设置。

下面的几行文字中提到只支持数组和列表。