Answer the question
In order to leave comments, you need to log in
How to remove all Embeddable objects from HashMap with specific key?
@Embeddable
class Item{
String value
}
class R{
@...
Map<Integer, Item> values;
}
List<R> r = JPA.em().createQuery("from R").getResultList();
for (R resp : r) {
resp.values.remove(f.getId());
JPA.em().persist(resp);
}
Query qRemove = JPA.em().createNativeQuery("delete from r_values where val_id = :id");
qRemove.setParameter("id", f.getId());
qRemove.executeUpdate();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question