Hello dear community.
I would like to use sql's "in" function for selecting something but it delivers wrong results.
When i perform the same command directly on the database, it works fine:
the command should be this:
Code:
SELECT count( * )
FROM productcategory_product
WHERE `productcategoryid`
IN ( 2, 3 )
delivering a result of 8.
with hibernate, I created this command:
Code:
results = (BigInteger) getSession().createSQLQuery("select count(*) as productSum from " + ProductCategoryDO.PRODUCT_RELATION_TABLE + " where " + ProductCategoryDO.PRODUCT_RELATION_COLUMN + " in (:productIdList)")
.setParameter("productIdList", idString).uniqueResult();
where productIdList is "2,3".
unfortunately, it always delivers 7 as result.
My table looks like this:
Code:
productcategoryid productid
2 1
2 2
2 3
2 4
2 5
2 6
2 7
3 8
Do you might know what to do?