I'm creating a database query with JPA and need to exclude a list from the result. How should I do this?
public List<PersonEntity> getPersonsWithoutNotWanted(List<Long> notWantedId ) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<PersonEntity> cq = cb.createQuery(PersonEntity.class);
Root<PersonEntity> root = cq.from(PersonEntity.class);
// How to add a Predicate or something else to remove all notWantedId's
TypedQuery<RequestableEntity> query = em.createQuery(cq);
return query.getResultList();
}