I want to know if I can perform em.remove
for each element in that local list? Does this code changes state in DB?
TypedQuery<Product> query = em.createNamedQuery("Product.findByCode", Product.class);
query.setParameter("code", code);
List<Product> productList= query.getResultList();
for (int i = 1; i < productList.size(); i++) {
em.remove(productList.get(i));
}