Here is my query i have done using jdbc.webshopProducts is the Map.
StringBuilder queryString=new StringBuilder();
queryString.append(" select cpm.name,cpm.catalogueprice,cpm.catalogueno ");
queryString.append(" from customer_product_master cpm ");
queryString.append(" where cpm.catalogueno in (?) ");
stmt=con.prepareStatement(queryString.toString());
stmt.setString(1,StringUtils.join(webshopProducts.keySet(),','));
rs=stmt.executeQuery();
webshopProductList=new ArrayList<WebshopProductVO>();
while(rs.next()){
WebshopProductVO webshopProduct=new WebshopProductVO();
webshopProduct.setArticleno(rs.getInt("catalogueno"));
webshopProduct.setName(rs.getString("name"));
webshopProduct.setPrice(rs.getFloat("catalogueprice"));
webshopProduct.setQuantity(webshopProducts.get(rs.getInt("catalogueno")));
webshopProduct.setSum(rs.getFloat("catalogueprice")*webshopProducts.get(rs.getInt("catalogueno")));
webshopProductList.add(webshopProduct);
}
I have used StringUtils.join(webshopProducts.keySet(),',') to generate a comma seperated list of integers.The problem i am facing is when there is more than one value in the map only one WebshopProductVO is being added to the webshopProductList even though there are many ones.