From 34499abd609c1b2e4570f969d63546e56c5c153f Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Sat, 13 Apr 2019 22:59:59 +0400 Subject: [PATCH] #62 fix remove deadline in other JPA operation --- .../java/ru/ulstu/conference/service/ConferenceService.java | 3 +-- src/main/java/ru/ulstu/deadline/service/DeadlineService.java | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/ru/ulstu/conference/service/ConferenceService.java b/src/main/java/ru/ulstu/conference/service/ConferenceService.java index 46e7ff7..ac44d4b 100644 --- a/src/main/java/ru/ulstu/conference/service/ConferenceService.java +++ b/src/main/java/ru/ulstu/conference/service/ConferenceService.java @@ -60,6 +60,7 @@ public class ConferenceService { public Integer update(ConferenceDto conferenceDto) throws IOException { Conference conference = conferenceRepository.findOne(conferenceDto.getId()); conferenceRepository.save(copyFromDto(conference, conferenceDto)); + conferenceDto.getRemovedDeadlineIds().forEach(deadlineService::remove); return conference.getId(); } @@ -74,8 +75,6 @@ public class ConferenceService { conference.setPing(0); conference.setBeginDate(conferenceDto.getBeginDate()); conference.setEndDate(conferenceDto.getEndDate()); - conferenceDto.getRemovedDeadlineIds() - .forEach(deadlineService::remove); conference.setDeadlines(deadlineService.saveOrCreate(conferenceDto.getDeadlines())); return conference; } diff --git a/src/main/java/ru/ulstu/deadline/service/DeadlineService.java b/src/main/java/ru/ulstu/deadline/service/DeadlineService.java index d4ff2ef..0ef8a4f 100644 --- a/src/main/java/ru/ulstu/deadline/service/DeadlineService.java +++ b/src/main/java/ru/ulstu/deadline/service/DeadlineService.java @@ -45,6 +45,5 @@ public class DeadlineService { @Transactional public void remove(Integer deadlineId) { deadlineRepository.delete(deadlineId); - } }