I'm trying to exclude a bunch of results from a database SELECT using the "NOT IN" keywords, but the exclusion list is still being returned. Using JPQL (JPA2.0) my query looks like:
Query query = em.createQuery("SELECT foo.id FROM FooEntity fooEntity WHERE foo.id NOT IN ('" + exclusionList.toString() + "') ORDER BY foo.id").setFirstResult(startPosition).setMaxResults(numberOfAppsToReturn);
exclusionList is a StringBuffer. There is no error reported that I can see, but the id's in the exclusion list are still returned. Is there an alternative JPQL way of doing this?
Thanks in advance.