2

我遇到了命名查询参数的问题。我的查询如下:

<sql-query name="getCustomer">
<![CDATA[
     select * from customer where customerId=:custId and billId in ( :billIdList )
]]>
</sql-query>

我正在设置所有参数,但是每当我设置此参数时 :billIdList 出现问题,我都会得到一个空的客户列表。我的 :billIdList 是字符串形式,例如:5,6,7,9。DB中的数据也具有上述值。当我在自己的程序中编写查询时,它工作正常。

请帮我。

4

1 回答 1

1

对于具有多个值的参数,您需要使用setParameterList()HibernateQuery接口的方法:

query.setParameterList("billIdList", new int[] {5,6,7,9});
于 2009-10-01T16:17:05.060 回答