Hibernate HQL NOT IN 子句似乎不起作用
Hibernate HQL NOT IN clause doesn't seem to work
// 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);
这是我正在执行的查询。它没有给我 a = itemA and b is not in bList
的结果,而是 a = itemA and b IS IN bList
.
的结果
如有任何帮助,我们将不胜感激。
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);
// 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);
这是我正在执行的查询。它没有给我 a = itemA and b is not in bList
的结果,而是 a = itemA and b IS IN bList
.
如有任何帮助,我们将不胜感激。
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);