Skip to content

Commit

Permalink
fix: bug put questioning cascade save (#71)
Browse files Browse the repository at this point in the history
* fix: bug  put questioning cascade save

* chore: spring boot 3.3.1 and bump version 2.4.1
  • Loading branch information
BettyB979 authored Jun 28, 2024
1 parent b6244ec commit 4bb7362
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>fr.insee.survey</groupId>
<artifactId>platine-management</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<name>platine-management</name>
<description>REST API for communication between DB and Platine-Management UI and Platine-My-Surveys UI</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<>());
}
Expand Down Expand Up @@ -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(),
Expand All @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Questioning {
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private Set<QuestioningEvent> questioningEvents;

@ManyToOne(fetch = FetchType.EAGER)
@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@NonNull
private SurveyUnit surveyUnit;

Expand Down

0 comments on commit 4bb7362

Please sign in to comment.