When I run a post for the first time (when the id is not yet saved in the database) it is returning "ConcurrentModificationException: null";
dto.getObservations().stream()
.map(productObservationsService::convertDTOToModel)
.forEach(model::addObservation);
and this is my entity:
@OneToMany(mappedBy = "relatedProduct", cascade = {CascadeType.PERSIST, CascadeType.MERGE})
private List<ProductObservationModel> observations;
public void addObservation(ProductObservationModel observationModel) {
if (this.observations == null)
this.observations = new ArrayList<>();
observations.add(observationModel);
observationModel.setRelatedProduct(this);
}
Does anyone know what can it be?