From 4bb7362ca79afd27432082d89bf579be4bd25850 Mon Sep 17 00:00:00 2001 From: Betty Becuwe <77614323+BettyB979@users.noreply.github.com> Date: Fri, 28 Jun 2024 13:48:10 +0200 Subject: [PATCH] fix: bug put questioning cascade save (#71) * fix: bug put questioning cascade save * chore: spring boot 3.3.1 and bump version 2.4.1 --- pom.xml | 4 ++-- .../query/controller/WebclientController.java | 6 +----- .../questioning/domain/Questioning.java | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index af760a67..76566ab2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,12 +6,12 @@ org.springframework.boot spring-boot-starter-parent - 3.3.0 + 3.3.1 fr.insee.survey platine-management - 2.4.0 + 2.4.1 platine-management REST API for communication between DB and Platine-Management UI and Platine-My-Surveys UI diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java b/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java index f5717290..0f3e5487 100644 --- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java +++ b/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java @@ -131,7 +131,6 @@ public ResponseEntity putQuestioning(@RequestBody QuestioningWebclientDto que idSu); su.setQuestionings(new HashSet<>()); } - surveyUnitService.saveSurveyUnitAndAddress(su); // Create questioning if not exists Questioning questioning = questioningService.findByIdPartitioningAndSurveyUnitIdSu(idPartitioning, idSu); @@ -147,7 +146,6 @@ public ResponseEntity putQuestioning(@RequestBody QuestioningWebclientDto que questioningEvent.setType(TypeQuestioningEvent.INITLA); questioningEvent.setDate(new Date()); questioningEvent.setQuestioning(questioning); - questioningEventService.saveQuestioningEvent(questioningEvent); questioning.setQuestioningEvents(new HashSet<>(List.of(questioningEvent))); questioning.setQuestioningAccreditations(new HashSet<>()); } @@ -218,8 +216,7 @@ private void createContactAndAccreditations(String idSu, Partitioning part, Ques questioningAccreditation.setMain(contactAccreditationDto.isMain()); questioningAccreditation.setQuestioning(questioning); setExistingAccreditations.add(questioningAccreditation); - questioningAccreditationService.saveQuestioningAccreditation(questioningAccreditation); - questioningService.saveQuestioning(questioning); + // create view viewService.createView(contactAccreditationDto.getIdentifier(), questioning.getSurveyUnit().getIdSu(), @@ -230,7 +227,6 @@ private void createContactAndAccreditations(String idSu, Partitioning part, Ques // update accreditation QuestioningAccreditation questioningAccreditation = listContactAccreditations.get(0); questioningAccreditation.setMain(contactAccreditationDto.isMain()); - questioningAccreditationService.saveQuestioningAccreditation(questioningAccreditation); } } diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Questioning.java b/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Questioning.java index 28d37a24..65409dfa 100644 --- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Questioning.java +++ b/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Questioning.java @@ -30,7 +30,7 @@ public class Questioning { @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) private Set questioningEvents; - @ManyToOne(fetch = FetchType.EAGER) + @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @NonNull private SurveyUnit surveyUnit;