Skip to content

Commit 8437ebb

Browse files
committed
This should fix the same race condition in duplicate as 6c2a624 in create
The hashset is copied in toDto other we get "Found shared references to a collection org.hibernate.HibernateException" during the clone Signed-off-by: HARPER Jon <[email protected]>
1 parent 6c2a624 commit 8437ebb

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/main/java/org/gridsuite/study/server/StudyService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,6 @@ private CreatedStudyBasicInfos insertStudy(UUID studyUuid, String userId, Networ
580580
return createdStudyBasicInfos;
581581
}
582582

583-
@Transactional
584583
public CreatedStudyBasicInfos insertDuplicatedStudy(BasicStudyInfos studyInfos, StudyEntity sourceStudy, LoadFlowParametersEntity newLoadFlowParameters, String userId, UUID clonedNetworkUuid) {
585584
Objects.requireNonNull(studyInfos.getId());
586585
Objects.requireNonNull(userId);
@@ -592,7 +591,7 @@ public CreatedStudyBasicInfos insertDuplicatedStudy(BasicStudyInfos studyInfos,
592591

593592
UUID reportUuid = UUID.randomUUID();
594593
StudyEntity studyEntity = new StudyEntity(studyInfos.getId(), userId, LocalDateTime.now(ZoneOffset.UTC), clonedNetworkUuid, sourceStudy.getNetworkId(), sourceStudy.getCaseFormat(), sourceStudy.getCaseUuid(), sourceStudy.isCasePrivate(), sourceStudy.getLoadFlowProvider(), newLoadFlowParameters);
595-
CreatedStudyBasicInfos createdStudyBasicInfos = StudyService.toCreatedStudyBasicInfos(insertDuplicatedStudy(studyEntity, sourceStudy.getId(), reportUuid));
594+
CreatedStudyBasicInfos createdStudyBasicInfos = StudyService.toCreatedStudyBasicInfos(self.insertDuplicatedStudy(studyEntity, sourceStudy.getId(), reportUuid));
596595

597596
studyInfosService.add(createdStudyBasicInfos);
598597
emitStudiesChanged(studyInfos.getId(), userId);

src/main/java/org/gridsuite/study/server/networkmodificationtree/NetworkModificationNodeInfoRepositoryProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public NetworkModificationNode toDto(NetworkModificationNodeInfoEntity node) {
6868
int ignoreSize = node.getModificationsToExclude().size(); // to load the lazy collection
6969
return completeNodeInfo(node, new NetworkModificationNode(node.getNetworkModificationId(),
7070
node.getVariantId(),
71-
node.getModificationsToExclude(),
71+
new HashSet<>(node.getModificationsToExclude()),
7272
node.getLoadFlowStatus(),
7373
StudyService.fromEntity(node.getLoadFlowResult()),
7474
node.getSecurityAnalysisResultUuid(),

0 commit comments

Comments
 (0)