2012-01-04 60 views

回答

1

你可以只查詢是在表中,並在您設置的值,然後採取什麼樣的查詢返回的補充:

List<Integer> valuesInTheTable = 
    (List<Integer>) em.createQuery("select a.column from Entity a where a in (:values)") 
         .setParameter("values", values) 
         .getResultList(); 

Set<Integer> valuesNotInTheTable = new HashSet<Integer>(values); 
valuesNotInTheTable.removeAll(valuesInTheTable); 
+0

呀。可以做到這一點。謝謝 – JProgrammer 2012-01-05 10:08:08