views:

400

answers:

1

Hi,

I am having problem with named query parameter. My query is as follow:

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

I am setting all parameters, but having problem in :billIdList whenever I am setting this parameter I am getting a Empty list of customers. My :billIdList is in the string form e.g: 5,6,7,9. There is data in DB also with above values. It works fine when I am writing query in program it self.

Please help me.

A: 

For parameters with more than one value you need to use a setParameterList() method of Hibernate's Query interface:

query.setParameterList("billIdList", new int[] {5,6,7,9});
ChssPly76