Reputation: 4201
// a is some String and bList is some list of type ArrayList
String findQuery = "SELECT T FROM " + MyClass.class.getName() + " T where a = :itemA and (b NOT IN (:bList))";
Query query = factory.getCurrentSession().createQuery(findQuery);
query.setParameter("itemA", a);
query.setParameter("bList", bList);
This is the query I am executing. Instead of giving me results where a = itemA and b is not in bList
, it gives me results where a = itemA and b IS IN bList
.
Any help would be appreciated.
Upvotes: 0
Views: 3274
Reputation: 8956
String findQuery = "SELECT T FROM " + MyClass.class.getName() + " T where T.a =:itemA and T.b NOT IN (:bList)";
Query query = factory.getCurrentSession().createQuery(findQuery);
query.setParameter("itemA", a);
query.setParameterList("bList", bList);
Upvotes: 4