When I save a list of added elements I get a concurrent modification exception. Below is the code of the save method called:
listAta listata = em.findbyid(id);
for (adressata ad : getInstance().getList()) {
em.merge(ad);
}
em.merge(listata);
em.flush();
The line that caused the exception is for (adressata ad : getInstance().getList())
Below is the entity data:
@ManyToOne((fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinColumn(name="id_list" , nullable=false)
private ListAta listAta;
How is this caused and how can I solve it?